>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 > >>
>>>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 >>> >>>