Hello,
To save a complete Window or Dialog to a BMP, ( Screen-Capture ) SaveToBmp is used.
Is it possible , to define : TOP, LEFT, BOTTOM and RIGHT to save only a Screen-Area ?
Best Regards
Uwe
HB_FUNC( WNDBITMAP ) // hWnd [, nTop, nLeft, nBottom, nRight ] --> hBitmap
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = GetWindowDC( hWnd );
HDC hMem = CreateCompatibleDC( hDC );
RECT rct;
HBITMAP hBmp, hOldBmp;
if( hb_pcount() == 1 )
GetWindowRect( hWnd, &rct );
else
{
rct.top = hb_parnl( 2 );
rct.left = hb_parnl( 3 );
rct.bottom = hb_parnl( 4 );
rct.right = hb_parnl( 5 );
}
hBmp = CreateCompatibleBitmap( hDC, rct.right - rct.left,
rct.bottom - rct.top );
hOldBmp = ( HBITMAP ) SelectObject( hMem, hBmp );
BitBlt( hMem, 0, 0, rct.right - rct.left, rct.bottom - rct.top, hDC, rct.left, rct.top, SRCCOPY );
SelectObject( hMem, hOldBmp );
DeleteDC( hMem );
ReleaseDC( hWnd, hDC );
hb_retnl( ( LONG ) hBmp );
}
I tested something like oVTitle5:SaveToBmp( "Test.bmp" ),
but returns only a black BMP.
#include 'fivewin.ch'
#include 'ttitle.ch'
function main()
local oDlg, oTitle
DEFINE DIALOG oDlg SIZE 600,200 PIXEL
@ 05,05 TITLE oTitle SIZE 290,32 OF oDlg ;
SHADOW BOTTOMRIGHT SHADOWSIZE 5
@ 10,10 TITLEIMG OF oTitle BITMAP '\fwh\bitmaps\fivetech.bmp' SIZE 48,48
ACTIVATE DIALOG oDlg CENTERED ON RIGHT CLICK oTitle:SaveToBmp( 'C:\T.BMP' )
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 105 guests