如题,调用如下函数
HANDLE hPrinter,
OpenPrinter(_T"中文名",&hPrinter,NULL);
时总是出错,返回打印机名字不正确,请问应该如何修改或转换中文名字编码,谢谢

解决方案 »

  1.   

    The OpenPrinter function retrieves a handle to the specified printer or print server or other types of handles in the print subsystem. BOOL OpenPrinter(
      LPTSTR pPrinterName,         // printer or server name
      LPHANDLE phPrinter,          // printer or server handle
      LPPRINTER_DEFAULTS pDefault  // printer defaults
    );
    Parameters
    pPrinterName 
    [in] Pointer to a null-terminated string that specifies the name of the printer or print server, the printer object, the XcvMonitor, or the XcvPort. 
    For a printer object use: PrinterName,Job xxxx. For an XcvMonitor, use: ServerName,XcvMonitor MonitorName. For an XcvPort, use: ServerName,XcvPort PortName.Windows NT/2000/XP: If NULL, it indicates the local printer server.
      

  2.   

    _T("XXXXX")宏要用括号打印机最好是枚举下或是用默认打印机,否则使用环境变了,程序就不能用了