Using Win32 functions in Visual FoxPro Image Gallery
Common Dialog Box
..msdn
ChooseColor
ChooseFont
CommDlgExtendedError
FindText
GetFileTitle
GetOpenFileName
GetSaveFileName
PageSetupDlg
PrintDlg
PrintDlgEx
TaskDialog
TaskDialogIndirect
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)
Retrieving graphic capabilities of default printer
Retrieving Printer Device Context using PrintDlg function
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: 71  
    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-2013 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.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (107.21.156.140)
    53.23 min.Function: 'DrawMenuBar'
    Function group: 'Menu'
    53.28 min.Example: 'GDI+: Color Transparency'
    53.35 min.Example: 'How to display advanced Task Dialog (Vista)'
    1.91 hrs.Example: 'How to print picture stored in enhanced-format metafile (*.emf)'
     Function: 'CryptEnumProviderTypes'
    2.58 hrs.Example: 'Enumerating servers of the specified type (e.g. SQL Server) in the primary domain'
     Example: 'Extracting the name and extension parts of a path string'
     Example: 'GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)'
    5.16 hrs.Example: 'Using the GetLogicalDriveStrings'
     
    Function group: 'Memory Management'
    Google
    Advertise here!