Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>getprintdc()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
GetPrintDC()
Get access to a printer for drawing purposes
------------------------------------------------------------------------------

Syntax
GetPrintDC()   -->   hDC

Arguments
None.

Returns
If successful, this function returns a handle to a device
context for the printer.  This handle will be a non-zero
numeric.  Otherwise, zero (0) is returned.

Description
Drawing in Windows is done using GDI (graphics device
interface) functions, which require a handle to a device
context.  This function returns a suitable handle for drawing
on the printer.  For the display, see the GetDC() function.

Before returning the handle, this function displays a printer
dialog box so that the user can decide the settings.  If the
user cancels the dialog, zero (0) is returned.

Example
// use the standard printer dialog to set the printer up
hPrintDC = GetPrintDC()      // returns 0 if cancelled
if  hPrintDC  ! =  0
     // print a test page
     nWidth = GetDeviceCaps( hPrintDC, HORZRES )
     nHeight = GetDeviceCaps( hPrintDC, VERTRES )
     StartDoc( hPrintDC, "TestOutput" )
     StartPage( hPrintDC )
     TextOut( hPrintDC, 100, 50, "Clip-4-Win Printer Test Page" )
     Rectangle( hPrintDC, 0, 0, nWidth, nHeight )
     MoveTo( hPrintDC, nWidth, 0 )
     LineTo( hPrintDC, 0, nHeight )
     EndPage( hPrintDC )
     EndDoc( hPrintDC )
     DeleteDC( hPrintDC )
endif


See Also: CreateDC() DeleteDC() PrintDlg()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson