1

我希望有人能指出我在下面遇到的打印问题的正确方向:

设置:Win CE 5.0 尝试从自定义应用程序打印。

我在我的应用程序中编写了一个非常简单的打印类,它使用 pcl 驱动程序并打印到 HP USB 打印机。在正常情况下打印方面很好,但我看不到处理错误情况的明显方法,例如打印机中没有纸等。

我正在做这样的事情(为清楚起见,删除了一般错误检查和其他细节):

// Get a DC to the printer. If printer isn't powered this will fail -
can print error stating "printer not found" or similar
hdcPrinter = CreateDC(@"pcl.dll", @"PCL Inkjet", @"LPT2:", ref mode);


// Signal the start of a document
StartDoc(hdcPrinter, &docInfo)
// Signal the start of a page
StartPage(hdcPrinter)

// Prepare the page to print/formatting etc

// Finished preparing the page
EndPage(hdcPrinter)

// This is the only page we are printing this time
EndDoc(hdcPrinter)

// Return the printer DC to the system as we are finished with it now.
DeleteDC(hdcPrinter);

感谢您的任何帮助,您可以提供,

希尔帕

4

1 回答 1

1

即使打印机缺纸、卡纸或其他未准备好,您确定让 DC 成功吗?

一旦您开始打印作业,如果打印机出现问题,这不是您的问题。此时,操作系统应该与用户交互并让他们知道存在问题,必要时重新启动作业等......

于 2012-08-06T18:42:29.233 回答