我要做一个打印设置页面。
我要获得如下信息:
1。当前系统安装的打印机
2。当选中一个打印机的时候获得此打印机所支持的纸张类型。
3。当选种一种纸张类型后,获得此类型纸张的实际尺寸。
4。获得上述信息后,对上述信息如何设置。我使用 EnumPrinter 获得打印机不好使。看别人的帖子说98下使用EnumPrinter而2000下得使用函数 GetDefaultPrinter。但是我的 VC6.0的帮助中没有此函数的帮助。我装了VC6.0的sp5也没有此函数,而且 winspool.h中也没有此函数定义。我该怎么办?
我要获得如下信息:
1。当前系统安装的打印机
2。当选中一个打印机的时候获得此打印机所支持的纸张类型。
3。当选种一种纸张类型后,获得此类型纸张的实际尺寸。
4。获得上述信息后,对上述信息如何设置。我使用 EnumPrinter 获得打印机不好使。看别人的帖子说98下使用EnumPrinter而2000下得使用函数 GetDefaultPrinter。但是我的 VC6.0的帮助中没有此函数的帮助。我装了VC6.0的sp5也没有此函数,而且 winspool.h中也没有此函数定义。我该怎么办?
DEVMODE结构体的具体用法msdn里有详细地介绍!
:)
可以得到用::EnumPrinters来玫举
The DeviceIoControl function sends a control code directly to a specified device driver, causing the corresponding device to perform the specified operation. BOOL DeviceIoControl( HANDLE hDevice, // handle to device of interest
DWORD dwIoControlCode, // control code of operation to perform
LPVOID lpInBuffer, // pointer to buffer to supply input data
DWORD nInBufferSize, // size of input buffer
LPVOID lpOutBuffer, // pointer to buffer to receive output data
DWORD nOutBufferSize, // size of output buffer
LPDWORD lpBytesReturned, // pointer to variable to receive output byte count
LPOVERLAPPED lpOverlapped // pointer to overlapped structure for asynchronous operation
);
{
public:
GPrinter(); // open a printer with the name 'lpszPrinterName'
BOOL Open(LPCTSTR lpszPrinterName, PRINTER_DEFAULTS *lpDefaults=NULL);
// get various types of printer info
// pInfo is good for the lifetime of the class, or until the next call to Get(),
// whichever comes first
BOOL Get(PRINTER_INFO_1 *pInfo);
BOOL Get(PRINTER_INFO_2 *pInfo);
BOOL Get(PRINTER_INFO_3 *pInfo);
BOOL Get(PRINTER_INFO_4 *pInfo);
BOOL Get(PRINTER_INFO_5 *pInfo);
BOOL Get(PRINTER_INFO_7 *pInfo);
// set to TRUE to turn off message box reporting of errors
void SetSilent(BOOL bSilent=TRUE);
// handy operator to return printer object handle
operator HANDLE() const {return m_hPrinter;}protected:
BOOL Get(int nLevel, LPBYTE lpBuf, int nBufSize); HANDLE m_hPrinter; // handle to the printer object
LPBYTE m_lpGetInfoBuf; // temporary buffer
BOOL m_bSilent; // silent mode flagpublic:
// closes the open printer object
void Close(); virtual ~GPrinter();
};