How do I set Landscape printing

Started by Martin Francom, November 23, 2011, 12:43:58 PM

Previous topic - Next topic

Martin Francom

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?

José Roca

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


Martin Francom

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



José Roca

You can use the AfxGetDefaultPrinter function.

Martin Francom

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?

José Roca

AfxPrint.inc is not part of the Windows API headers, but a file with some convenient wrapper functions, that you can use or not.