Using Win32 functions in Visual FoxPro Image Gallery
Printing and Print Spooler
..msdn
AddPort
AddPrinter
ClosePrinter
ConfigurePort
ConnectToPrinterDlg
DeletePort
DeviceCapabilities
DocumentProperties
EndDoc
EndPage
EnumForms
EnumJobs
EnumPorts
EnumPrinterData
EnumPrinterDrivers
EnumPrinters
EnumPrintProcessorDatatypes
EnumPrintProcessors
Escape
FindClosePrinterChangeNotification
FindFirstPrinterChangeNotification
FindNextPrinterChangeNotification
FreePrinterNotifyInfo
GetDefaultPrinter
GetPrinter
GetPrinterData
GetPrinterDriverDirectory
GetPrintProcessorDirectory
OpenPrinter
PrinterProperties
SetDefaultPrinter
SetJob
SetPrinter
StartDoc
StartPage
Code examples:
GDI+: printing image file
GDI+: sending image of FoxPro form to printer
How to print a bitmap file
How to print FoxPro form
How to print FoxPro form -- II
How to print picture stored in enhanced-format metafile (*.emf)
Printing Image File, programmatically set print page orientation to landscape
GDI+: printing image file

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
The code is based on custom GDI+ class. Download the class module first and save it in gdiplus.prg file.

Make sure the source file name is valid. The source file can be in any of graphics formats supported by the GDI+: BMP, GIF, JPG, TIF, EMF...

See also:
  • Printing Image File, programmatically set print page orientation to landscape
  • How to display the Print property sheet
  • SET PROCEDURE TO gdiplus ADDITIVE
    DO decl
    
    * an instance of gdiplusinit should be created before
    * and released after using any of gdi+ objects
    PRIVATE gdiplus
    gdiplus = CREATEOBJECT("gdiplusinit")
    
    LOCAL img, hPrnDC, gdip, docinfo
    hPrnDC = GetPrnDC()
    img = CREATEOBJECT("gdiimage", "c:\windows\forest.bmp")
    gdip = CREATEOBJECT("graphics", hPrnDC)
    
    docinfo = PADR(CHR(20), 20, CHR(0))
    = StartDoc(m.hPrnDC, m.docinfo)
    = StartPage(m.hPrnDC)
    WITH gdip
        .DrawImage(img, 20,20)
        .DrawImage(img, 25+img.imgwidth,20,;
            img.imgwidth/4, img.imgheight/4)
    ENDWITH
    = EndPage(m.hPrnDC)
    = EndDoc(m.hPrnDC)
    = DeleteDC(hPrnDC)
    * end of main
    
    FUNCTION GetPrnDC
    * returns device context of default printer
    #DEFINE PD_RETURNDC      0x100
    #DEFINE PD_RETURNDEFAULT 0x400
        LOCAL lcStruct, lnFlags
        lnFlags = PD_RETURNDEFAULT + PD_RETURNDC
    
        lcStruct = num2dword(66) + Repli(Chr(0), 16) +;
            num2dword(lnFlags) + Repli(Chr(0), 42)
        IF PrintDlg(@lcStruct) <> 0
            RETURN buf2dword (SUBSTR(lcStruct, 17,4))
        ENDIF
    RETURN 0
    
    PROCEDURE decl
        DECLARE INTEGER DeleteDC IN gdi32 INTEGER hdc
        DECLARE INTEGER PrintDlg IN comdlg32 STRING @ lppd
        DECLARE INTEGER StartPage IN gdi32 INTEGER hdc
        DECLARE INTEGER EndPage IN gdi32 INTEGER hdc
        DECLARE INTEGER EndDoc IN gdi32 INTEGER hdc
        DECLARE INTEGER StartDoc IN gdi32 INTEGER hdc, STRING lpdi
    
    
    

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1361 bytes  
    Created: 2004-07-08 09:30:41  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 64  
    Listed functions:
    DeleteDC
    EndDoc
    EndPage
    PrintDlg
    StartDoc
    StartPage
    Printer friendly API declarations
    My comment:


    #kwd: sln_gdiplus.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright 2001-2018 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.226.55.151)
    14 sec.Login
    25 sec.Function: 'CeRapiInvoke'
    Function group: 'Remote Application Programming (RAPI)'
    37 sec.Function: 'IsWow64Process'
    Function group: 'Process and Thread'
    50 sec.Function: 'mixerGetLineControls'
    Function group: 'Windows Multimedia'
    1.05 min.Function: 'DeleteFileTransacted'
    Function group: 'File Management'
    1.23 min.Function: 'EnumPrinters'
    Function group: 'Printing and Print Spooler'
    1.47 min.Function: 'mixerGetNumDevs'
    Function group: 'Windows Multimedia'
    1.68 min.Function: 'LoadImage'
    1.88 min.Function: 'InternetCanonicalizeUrl'
    2.08 min.Example: 'Retrieving window and menu help context identifiers'
    Google
    Advertise here!