>
>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?
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement