PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on November 23, 2011, 12:43:58 PM

Title: How do I set Landscape printing
Post by: Martin Francom on November 23, 2011, 12:43:58 PM
I am printing the contents of a RichEdit Control using:


    Dim rRect As Rect
    PrintRichTextBox HWND_FormReports_RICHEDIT1, rRect


I would like to set the Print Dialog Box to Landscape rather than the default Portrait
Can I do that programmatically?
Title: Re: How do I set Landscape printing
Post by: José Roca on November 23, 2011, 12:52:01 PM
You can include AfxPrint.inc and cal this function:


' ========================================================================================
' Sets the printer orientation.
' DMORIENT_PORTRAIT = Portrait
' DMORIENT_LANDSCAPE = Landscape
' ========================================================================================
FUNCTION AfxSetPrinterOrientation (BYVAL bstrPrinterName AS WSTRING, BYVAL nOrientation AS LONG) AS LONG

Title: Re: How do I set Landscape printing
Post by: Martin Francom on November 23, 2011, 11:27:47 PM
Jose,  If I don't know the printer name can It there something I can
set  bstrPrinterName to   so it sets the default printer to Landscape ?

I think I found my answer. I should use:

AfxGetDefaultPrinter () AS WSTRING


Title: Re: How do I set Landscape printing
Post by: José Roca on November 23, 2011, 11:36:29 PM
You can use the AfxGetDefaultPrinter function.
Title: Re: How do I set Landscape printing
Post by: Martin Francom on November 23, 2011, 11:55:12 PM
Jose'  why must I specifically include AfxPrint.inc   I thought FF35 automatically
include all your includes that are need for the project?

How do I know which of your API includes are automatically included by FireFly
and which ones are not?
Title: Re: How do I set Landscape printing
Post by: José Roca on November 24, 2011, 12:09:49 AM
AfxPrint.inc is not part of the Windows API headers, but a file with some convenient wrapper functions, that you can use or not.