开发者

Call to LocalPrintServer's GetPrintQueues hangs

开发者 https://www.devze.com 2023-02-12 05:58 出处:网络
In order to get a list of the available printers, I am using the following code: new LocalPrintServer().GetPrintQueues(new[] {

In order to get a list of the available printers, I am using the following code:

new LocalPrintServer().GetPrintQueues(new[] { 
    EnumeratedPrintQueueTypes.Local, 
    EnumeratedPrintQueueTypes.Connections });

In the past this c开发者_开发百科ode worked fine, but now it hangs on the GetPrintQueues call.

What might cause this?


Whatever the issue was seems to have resolved itself, so perhaps there was some problem with the print spooler that worked itself out.

I also found that, since I only need the printer names, this is slightly faster:

new LocalPrintServer().GetPrintQueues(
   new[] { PrintQueueIndexedProperty.Name, 
       PrintQueueIndexedProperty.Location, PrintQueueIndexedProperty.ShareName },
   new[] { EnumeratedPrintQueueTypes.Local, 
       EnumeratedPrintQueueTypes.Connections });
0

精彩评论

暂无评论...
验证码 换一张
取 消