Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print Screen in VFP
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00113820
Message ID:
00170721
Views:
34
>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

Hi everyone,

I have been been trying to use the code above with some success, but mostly I get a general program failure in GDI.EXE. It does work to print one specific window once, but if I try to print it again, or try to print some other window, I get the error above.

If anyone knows what might be wrong, I am all ears...
(using VFP 3.0 for Win & Mac)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform