Group: Device Context - Library: gdi32
Creating a device context for the specified printer
Printing text with the Escape function
Printing Image File, programmatically set print page orientation to landscape
HDC CreateDC(
LPCTSTR lpszDriver, // driver name
LPCTSTR lpszDevice, // device name
LPCTSTR lpszOutput, // not used; should be NULL
CONST DEVMODE* lpInitData // optional printer data
);
DECLARE INTEGER CreateDC IN gdi32;
STRING lpszDriver,;
STRING lpszDevice,;
INTEGER lpszOutput,;
INTEGER lpInitData
lpszDriver For various Windows this parameter can be NULL, or can contain a null-terminated string.
lpszDevice [in] Pointer to a null-terminated character string that specifies the name of the specific output device being used.
lpszOutput This parameter is ignored for Win32-based applications, and should be set to NULL.
lpInitData [in] Pointer to a DEVMODE structure containing device-specific initialization data for the device driver.
If the function succeeds, the return value is the handle to a DC for the specified device. If the function fails, the return value is NULL.
The W2K Programming: the first way to obtain a printer device context is to use CreateDC function. The second way is to call PrintDlgEx function, which displays the Print common dialog box that allows the user to set various printing options.