* Author : Mauricio Atanache G.* Date : December 10/97
* This function puts the image of the form in the clipboard, you can use
* it to send form images to other aplications as Word etc.
* Also you can modify this function to print or copy any object on* screen.
* Parameters : oForm is an object FORM, for example THISFORM,ACTIVEFORM, _SCREEN
**************************************************************************
*Function TomaFoto
******************
lParameters oForm
Local nHwnd, tnHwnd, hDC, hDC_Mem, hBitMap, hPrevBmp
* Must use the Foxtools library, somewhere.
Declare integer FindWindow in Win32Api String cClassName, String cWindName
Declare integer GetDC in Win32Api integer nhwnd
Declare integer CreateCompatibleDC in Win32Api integer nhcd
Declare Integer BitBlt in Win32Api Integer hDestDC, Integer x, Integer y, ;
Integer nWidth, Integer nHeight, Integer hScrDC, ;
Integer xsrc, Integer ysrc, Integer dwRop
Declare Integer SelectObject in Win32Api Integer hDC, Integer hObject
Declare Integer CreateCompatibleBitmap in Win32Api Integer hDC, Integer nWidth, ;
Integer nHeight
Declare Integer SetClipboardData in Win32Api Integer nFormat, Integer hObject
Declare Integer DeleteDC in Win32Api Integer hDC
Declare Integer ReleaseDC in Win32Api Integer nwnd, Integer hdc
Declare Integer DeleteObject in Win32Api Integer hDC
lnwhandle = _WFindTitl(oForm.Caption)
nHwnd = _WhToHWnd(lnwhandle)
hDC = GetDC( nHwnd )
hDC_Mem = CreateCompatibleDC( hDC )
hBitMap = CreateCompatibleBitMap( hDC, oForm.Width, oForm.Height )
If hBitMap#0
hPrevBmp = SelectObject( hDC_Mem, hBitMap )
BitBlt( hDC_Mem, 0, 0, oForm.Width, oForm.Height, hDC, 0, 0, 13369376 )
If OpenClip( nHwnd )
EmptyClip()
SetClipboardData( 2, hBitMap )
CloseClip()
Else
MessageBox( 'Error opening the clipboard', 48, 'Message' )
Endif
Else
MessageBox( 'Error creating bitmap', 48, 'Menssage' )
Endif
DeleteDC( hDC_Mem )
ReleaseDC( nHwnd, hDC )
Return .t.
*******************************************