2011-09-26 10:57 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbgtcore.h
* harbour/src/rtl/gtclip.c
! fixed possible random data settings by hb_gt_winapi_setClipboard()
! fixed possible memory leak in hb_gt_winapi_setClipboard()
+ added new C function for WIN32 builds:
HB_BOOL hb_gt_winapi_setClipboardRaw( HB_UINT uFormat,
void * pData, HB_SIZE nSize );
This commit is contained in:
@@ -16,6 +16,15 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-09-26 10:57 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbgtcore.h
|
||||
* harbour/src/rtl/gtclip.c
|
||||
! fixed possible random data settings by hb_gt_winapi_setClipboard()
|
||||
! fixed possible memory leak in hb_gt_winapi_setClipboard()
|
||||
+ added new C function for WIN32 builds:
|
||||
HB_BOOL hb_gt_winapi_setClipboardRaw( HB_UINT uFormat,
|
||||
void * pData, HB_SIZE nSize );
|
||||
|
||||
2011-09-24 11:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbmzip/mzip.c
|
||||
! HB_UNZIPFILEINFO(): date returned was off by one month.
|
||||
|
||||
@@ -602,6 +602,7 @@ extern HB_BOOL hb_gt_setClipboard( const char * szClipData, HB_SIZE nLen );
|
||||
extern HB_BOOL hb_gt_getClipboard( char ** pszClipData, HB_SIZE * pnLen );
|
||||
#if defined( HB_OS_WIN )
|
||||
extern HB_EXPORT HB_BOOL hb_gt_winapi_setClipboard( HB_UINT uFormat, PHB_ITEM pItem );
|
||||
extern HB_EXPORT HB_BOOL hb_gt_winapi_setClipboardRaw( HB_UINT uFormat, void * pData, HB_SIZE nSize );
|
||||
extern HB_EXPORT HB_BOOL hb_gt_winapi_getClipboard( HB_UINT uFormat, PHB_ITEM pItem );
|
||||
extern HB_EXPORT int hb_gt_winapi_getKbdState( void );
|
||||
extern HB_EXPORT void hb_gt_winapi_setKbdState( int kbdShifts );
|
||||
|
||||
@@ -118,6 +118,42 @@ HB_BOOL hb_gt_getClipboard( char ** pszClipData, HB_SIZE * pnLen )
|
||||
|
||||
#if defined( HB_OS_WIN )
|
||||
|
||||
HB_BOOL hb_gt_winapi_setClipboardRaw( HB_UINT uFormat, void * pData, HB_SIZE nSize )
|
||||
{
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
|
||||
if( OpenClipboard( NULL ) )
|
||||
{
|
||||
EmptyClipboard();
|
||||
|
||||
if( nSize )
|
||||
{
|
||||
/* Allocate a global memory object for the text. */
|
||||
HGLOBAL hglb = GlobalAlloc( GMEM_MOVEABLE, nSize );
|
||||
if( hglb )
|
||||
{
|
||||
/* Lock the handle and copy the text to the buffer. */
|
||||
LPVOID lpMem = GlobalLock( hglb );
|
||||
|
||||
if( lpMem )
|
||||
{
|
||||
memcpy( lpMem, pData, nSize );
|
||||
( void ) GlobalUnlock( hglb );
|
||||
/* Place the handle on the clipboard. */
|
||||
fResult = SetClipboardData( ( UINT ) uFormat, hglb ) != 0;
|
||||
}
|
||||
if( !fResult )
|
||||
GlobalFree( hglb );
|
||||
}
|
||||
}
|
||||
else
|
||||
fResult = HB_TRUE;
|
||||
|
||||
CloseClipboard();
|
||||
}
|
||||
return fResult;
|
||||
}
|
||||
|
||||
HB_BOOL hb_gt_winapi_setClipboard( HB_UINT uFormat, PHB_ITEM pItem )
|
||||
{
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
@@ -152,13 +188,17 @@ HB_BOOL hb_gt_winapi_setClipboard( HB_UINT uFormat, PHB_ITEM pItem )
|
||||
else
|
||||
hb_itemCopyStr( pItem, hb_setGetOSCP(),
|
||||
( char * ) lpMem, nSize + 1 );
|
||||
fResult = HB_TRUE;
|
||||
( void ) GlobalUnlock( hglb );
|
||||
/* Place the handle on the clipboard. */
|
||||
fResult = SetClipboardData( ( UINT ) uFormat, hglb ) != 0;
|
||||
}
|
||||
( void ) GlobalUnlock( hglb );
|
||||
/* Place the handle on the clipboard. */
|
||||
SetClipboardData( ( UINT ) uFormat, hglb );
|
||||
if( !fResult )
|
||||
GlobalFree( hglb );
|
||||
}
|
||||
}
|
||||
else
|
||||
fResult = HB_TRUE;
|
||||
|
||||
CloseClipboard();
|
||||
}
|
||||
return fResult;
|
||||
|
||||
Reference in New Issue
Block a user