Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print Screen in VFP
Message
 
To
04/12/1998 16:09:39
Raymond Humphrys
Michigan Department of Community Health
Bath, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00113820
Message ID:
00164631
Views:
30
I got if off the MSDN CD that came with Visual Studio 97. Search it for the WinCap32 sample. I also found the WinCap sample on the MS web-site. I checked and the version they have out there now only has the source not the compiled dll. They do have another sample that has the dll included
PALFADE sample

The license file with WinCap32 says you can distribute components of it with your application as long as your application adds value. i.e not just a print screen utility.

In addition to printing screens tou can also save them as bitmaps. Very useful to get screen shots for documenation. Here's my SaveWindowAsBitmap method:
LPARAMETERS tnHWnd, tcDefaultName

LOCAL lnHBitmap && Handle to bitmap
LOCAL lcFileName	&& Name of file

LOCAL lnRetVal 	&& API call returned value

DECLARE INTEGER CopyWindowToDIB IN DibAPI32 INTEGER hWnd, INTEGER fPrintArea
DECLARE INTEGER SaveDIB IN DibAPI32 INTEGER hBitmap, STRING @ cFileName

#DEFINE PW_WINDOW 1
#DEFINE PW_CLIENT 2

lcFileName = PUTFILE("Save as Bitmap", tcDefaultName, "BMP")
IF EMPTY(lcFileName)
	RETURN
ENDIF

lnHBitmap = CopyWindowToDIB(tnHWnd, PW_WINDOW)
IF EMPTY(lnHBitmap)
	= MESSAGEBOX("Unable to create Bitmap from window", ;
				MB_ICON_EXCLAMATION + MB_OK, ;
				oApp.cApplicationName )
	RETURN
ENDIF

lnRetVal = SaveDIB(lnHBitmap, @lcFileName)
IF lnRetVal != 0
	= MESSAGEBOX("Unable to save the bitmap as: " + lcFileName + CRLF + ;
					"PrintDIB returned " + STR(lnRetVal), ;
				MB_ICONEXCLAMATION + MB_OK, ;
				oApp.cApplicationName)
ENDIF

RETURN
>Thanks for the Method. I can't find that dll anywhere. Where did you find it?
>
>Thanks,
>
>ray
>>>I'm trying to add print screen capabilities to a VFP app. I understand that you can copy the contents of a screen to the clipboard with Alt-PrintScrn and that you can paste those contents into a general field in a database. I haven't been able to create a report that prints general fields, though. Is it possible?
>>>
>>>Or, is there some command or API call that will dump the contents of the clipboard straight to the printer?
>>>
>>>This app is targeted towards folks who are not necessariliy computer-literate, so I want to make this as simple as possible.
>>>
>>> TIA,
>>> ROB
>>
>>The best solution I have found is to use the DibApi32 DLL that is part of the WinCap sample on the MSDN CD (also available from the MS web site, search for WinCap). It contains a PrintWindow function that does a screen print.
>>
>>This is the PrintWindow method from my application class
>>
>>
>>LPARAMETERS tnHWnd, tcJobName
>>LOCAL lcJobName
>>LOCAL lnRetVal
>>
>>DECLARE INTEGER PrintWindow IN DibApi32 ;
>>	INTEGER HWnd, ;
>>	INTEGER fPrintArea, ;
>>	INTEGER fPrintOpt, ;
>>	INTEGER wxScale, ;
>>	INTEGER wyScale, ;
>>	STRING @ szJobName
>>	
>>#DEFINE PW_WINDOW 1
>>#DEFINE PW_CLIENT 2
>>#DEFINE PW_BESTFIT 1
>>#DEFINE PW_STRETCHTOPAGE 2
>>#DEFINE PW_SCALE 3
>>
>>lcJobName = tcJobName + CHR(0)
>>lnRetVal = PrintWindow( tnHWnd, PW_WINDOW, PW_STRETCHTOPAGE, 0, 0, @lcJobName)
>>IF lnRetVal != 0
>>	IF lnRetVal != 6	&& 6 = User canceled printing
>>		= MESSAGEBOX("Unable to print the window" + CRLF + ;
>>			"PrintWindow API call returned " + STR(lnRetVal), ;
>>			MB_ICONEXCLAMATION + MB_OK, ;
>>			oApp.cApplicationName)
>>	ENDIF
>>ENDIF
>>RETURN
>>
>>
Steve Ruhl
CitiMortgage, Inc.
steven.ruhl@citibank.com Office
Steve@steven-ruhl.com Home
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform