Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More screen print info
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00124126
Message ID:
00124947
Views:
23
>
>Here is an example of the method I use to print a form:
>
>* PrintWindow Method
>LOCAL lnHWnd
>LOCAL lcJobName
>LOCAL lnRetVal
>
>DECLARE INTEGER GetFocus IN WIN32API
>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
>
>lnHWnd = GetFocus() && Use this to print a form
>*lnHWnd = MainhWnd() && Use this to print the VFP screen
>
>lcJobName = "Print job name" + CHR(0)
>lnRetVal = PrintWindow( lnHWnd, 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

Steven - I followed your instructions and downloaded the dibapi32.dll, copied your code and tried running it in vfp. I continue to get the following error:-
'An error occured during this operation'
I can't seem to get pass this error. I tried debugging the code and the error is occuring at the printwindow api function call. Could you help to guide this poor critter along the right path?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform