下面这个问题:How do I retrieve a list or number of jobs from a printer queue?如何使用LocalPrintServer定位特定的打印机?
我仍然坚持如何针对特定的打印机,我目前只知道使用LocalPrintServer类的名称。该应用程序应该一次打印到多台机器,所有打印机打印机需要分别进行监控。任何人都可以提供一段代码片断,说明我如何仅使用打印机的名称实例化LocalPrintServer对象?
在此先感谢!
编辑:添加的解决方案的代码片段:
private int GetNumberOfPrintJobs()
{
LocalPrintServer server = new LocalPrintServer();
PrintQueueCollection queueCollection = server.GetPrintQueues();
PrintQueue printQueue = null;
foreach (PrintQueue pq in queueCollection)
{
if (pq.FullName == PrinterName) //PrinterName is a classmember
printQueue = pq;
}
int numberOfJobs = 0;
if (printQueue != null)
numberOfJobs = printQueue.NumberOfJobs;
return numberOfJobs;
}
这毕竟不是那么难!
这实际上是我想要尝试的。我会检查出来的! – 2011-04-13 08:30:16