CPrinterConfig Class
class CPrinterConfig
The CPrinterConfig class encapsulates the Windows DEVNAMES and DEVMODE structures used by printing systems for identifying and configuring printers. CPrinterConfig takes care of the messy details involved in allocating and manipulating these variable length structures and provides convenient accessors and methods that allow you to work with them. All physical measurements are in units of 0.1mm (MM_LOMETRIC).NOTE: CPrinterConfig is an abstract class and cannot be directly instantiated. For configuring the printer, you must use the CPrinterConfigImpl template class.
Defined in: PrinterConfig.h
See Also
Class Members
virtual HGLOBAL GetDevNames() const
Returns a handle to the DEVNAMES structure.
virtual void SetDevNames(const HGLOBAL hSrcDevNames)
Sets the DEVNAMES structure.
virtual HGLOBAL GetDevMode() const
Returns a handle to the DEVMODE structure.
virtual void SetDevMode(const HGLOBAL hSrcDevMode)
Sets the DEVMODE structure.
inline virtual HDC CreateDC() const
Creates a device context using the information specified in the DEVNAMES and DEVMODE structures.
inline virtual void LoadPrintDlg(PRINTDLG& printDlg)
Updates the PRINTDLG parameter with the DEVNAMES and DEVMODE information stored in CPrinterConfig.
inline virtual void StorePrintDlg(const PRINTDLG& printDlg)
Updates CPrinterConfig's DEVNAMES and DEVMODE members with the global memory handles specified in the PRINTDLG parameter.
inline virtual void LoadPageSetupDlg(PAGESETUPDLG& psd)
Updates the PAGESETUPDLG parameter with the DEVNAMES and DEVMODE handles stored in CPrinterConfig.
inline virtual void StorePageSetupDlg(const PAGESETUPDLG& psd)
Updates CPrinterConfig's DEVNAMES and DEVMODE members with the handle information specified in the PAGESETUPDLG parameter.
inline LPTSTR GetDriverName() const
Returns a pointer to a null-terminated string that contains the device driver file name specified in CPrintConfig's DEVNAMES member.
inline LPTSTR GetDeviceName() const
Returns a pointer to a null-terminated string that contains the device name specified in CPrintConfig's DEVNAMES member.
inline LPTSTR GetOutputName() const
Returns a pointer to a null-terminated string that contains the device name for the physical output medium.
inline void SetDefaultPrinter()
Sets CPrinterConfig's DEVNAMES and DEVMODE members to handles that have been initialized for the system default printer.
inline bool PrinterExists() const
Returns TRUE if the information specified in CPrinterConfig accurately identifies an existing printer. Else FALSE.
inline short GetOrientation() const
Returns the paper orientation specified in the DEVMODE structure. Valid return values are DMORIENT_PORTRAIT and DMORIENT_LANDSCAPE.
inline void SetOrientation(const short nOrientation)
Sets the printer's paper orientation. This can be either DMORIENT_PORTRAIT or DMORIENT_LANDSCAPE.
inline short GetPaperSize() const
Returns the paper size specified in CPrinterConfig's DEVMODE structure. For information on paper sizes, please refer to the Win32 documentation on the DEVMODE structure.
inline void SetPaperSize(const short nPaperSize)
Sets the printer's paper size. For information on paper sizes, please refer to the Win32 documentation on the DEVMODE structure.
inline short GetPaperLength() const
Returns the paper length specified in the DEVMODE structure's dmPaperLength member.
inline void SetPaperLength(const short nPaperLength)
Sets the dmPaperLength member in CPrinterConfig's DEVMODE structure.
inline short GetPaperWidth() const
Returns the paper width specified in the DEVMODE structure's dmPaperWidth member.
inline void SetPaperWidth(const short nPaperWidth)
Sets the dmPaperWidth member in CPrinterConfig's DEVMODE structure.
inline short GetNumCopies() const
Returns the number of copies specified in CPrinterConfig's DEVMODE member.
inline void SetNumCopies(const short nNumCopies)
Sets the number of copies, dmCopies, in CPrinterConfig's DEVMODE structure.
inline bool GetPrinterMargins(RECT& rcPrinterMargins)
Retrieves the logical coordinates identifying the physical page's printable area.
inline bool GetPaperMeasurements(SIZE& szPaper)
Retrieves the paper size specified in CPrinterConfig's DEVMODE member.