- Code: Select all Expand view RUN
hBmp := wndBitmap( oDlg:hWnd )
But, how I can write this image of hBmp into a simple variavel?
hBmp := wndBitmap( oDlg:hWnd )
cImage := someFunctionToSaveHbmp( hBmp )
wndBitmap( oDlg:hWnd ) to variable?
But, how I can write this image of hBmp into a simple variavel?
local cImage
oDlg:SaveToBmp( "temp.txt" )
cImage = MemoRead( "temp.txt" )
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
typedef FAR * FARP;
WORD far pascal wDIBColors( LPBITMAPINFOHEADER lpBmp );
char * DibToStr( HGLOBAL hDIB, unsigned long * pulSize )
{
LPBITMAPINFO Info = ( LPBITMAPINFO ) GlobalLock( hDIB );
void * Bits = ( void * ) ( ( FARP ) Info + Info->bmiHeader.biSize +
wDIBColors( ( LPBITMAPINFOHEADER ) Info ) * sizeof( RGBQUAD ) );
unsigned long ulSize = GlobalSize( ( HGLOBAL ) Info );
BITMAPFILEHEADER bmf;
int hBmp;
char * pStr = ( char * ) hb_xgrab( sizeof( bmf ) + ulSize );
bmf.bfType = 'BM';
bmf.bfSize = sizeof( bmf ) + ulSize;
bmf.bfReserved1 = 0;
bmf.bfReserved2 = 0;
bmf.bfOffBits = sizeof( bmf ) + ( FARP ) Bits - ( FARP ) Info;
memcpy( pStr, ( const char * ) &bmf, sizeof( bmf ) );
memcpy( pStr + sizeof( bmf ), ( const char * ) Info, ulSize );
GlobalUnlock( hDIB );
* pulSize = sizeof( bmf ) + ulSize;
return pStr;
}
//---------------------------------------------------------------------------//
HB_FUNC( DIBTOSTR ) // ( hDib ) --> cString
{
unsigned long ulSize = 0;
char * pStr = DibToStr( ( HGLOBAL ) hb_parnl( 1 ), &ulSize );
hb_retclen( pStr, ulSize );
hb_xfree( ( void * ) pStr );
}
//---------------------------------------------------------------------------//
#pragma ENDDUMP
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 36 guests