Childers,
You may use aRect to only get the window client rectangle.
In order to capture the canvas, you need some C acknowledge. I include with
this message the code of XA_CaptureBitmap() that can serve you as a starting
point
Regards,
XA_FUNC( XA_CAPTUREBITMAP ) // XA_CaptureBitmap( <hWnd>, [<aRect>] ) -->
hBitmap
{
HWND hwnd = (HWND) hb_parnl( 1 );
RECT rect;
HDC hdc = GetDC( hwnd ), hdcBmp;
HBITMAP hBmp;
if ( hb_pcount() > 1 )
{
rect.left = hb_parnl( 2 );
rect.top = hb_parnl( 3 );
rect.bottom = hb_parnl( 4 );
rect.right = hb_parnl( 5 );
}
else
GetClientRect( hwnd, &rect );
hdcBmp = CreateCompatibleDC( hdc );
hBmp = CreateCompatibleBitmap( hdc, rect.right - rect.left, rect.bottom -
rect.top );
SelectObject( hdcBmp, hBmp );
BitBlt( hdcBmp, 0, 0, rect.right - rect.left, rect.bottom - rect.top,
hdc, rect.left, rect.top, SRCCOPY );
DeleteDC( hdcBmp );
ReleaseDC( hwnd, hdc );
hb_retnl( (long) hBmp );
}
--
Ignacio Ortiz de Zúñiga
Xailer support / Soporte de Xailer
http://www.xailer.com
http://www.xailer.info
"Childers" <
NoSpamPlease@nycap.rr.com> escribió en el mensaje
news:4a1f0e3c$[email=2@svctag-j7w3v3j....]2@svctag-j7w3v3j....[/email]
> >>You may use: XA_CaptureBitmap( <hWnd>, [<aRect>] ) --> hBitmap
>
> In case you are drawing into a Window (Form). If you want to do the same
> job using a printer canvas is a not a good idea since the bitmap will
> normally have a tremendous size.
>
> Regards,<<
>
> Ok, thanks. Using the above suggestion, the following works:
>
>
> hBitMapImage := XA_CaptureBitMap( GetActiveWindow() )
> oGraphBitMap := TBitMap():CreateFromHandle( hBitMapImage )
> oGraphBitMap:Save( "C:DownloadTestBitMap.bmp" )
>
>
> , but it captures the form, which includes the canvas. That's workable.
>
> But is there a way to capture only the canvas, without any of the other
> objects on the form? How do we obtain the window handle for only the
> canvas?
>
>
>