From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to list printers + indicate if enabled disabled

hello

 

do you know if there is a way to list printers with their present state : unplugged /disabled, or plugged/enabled? (I allready know how to list them)

 

 

regards

Pierre FCentum TNS, Grenoble
Certified LabVIEW Associated Developer
0 Kudos
Message 1 of 5
(2,892 Views)

Try to search for some Windows dll, which works with printers. If you'll find one, try to create wrapper for it in LabVIEW.

I didn't do exactly the same task, but I beleive that there is such a dll, what you can reuse.

 

logos_middle.jpg

0 Kudos
Message 2 of 5
(2,839 Views)

Enclosed VI is a quick and dirty hack job to do de enumeration part of local printers. By changing the constants inside from 0x2 and 0xA to 0x10 and 0x18 respectively you can also get the remote printers (network and other remotely known printers).

 

Please note that the returned array of printers may actually contain top level printer containers that correspond to printer servers for instance and contain themselves a list of printers that has to be enumerated too.

This is indicated by the fact that the flags member in the record contains the flag 0x8000. In that case you would need to pass the name of that record to this function again and then get the actual resources this printer server contains.

 

LabVIEW also supports an Application Property "Printing:Available Printers" that will return you this information too. 

WIN Enumerate Printers.png

 

Testing for the status of the printer is a different topic. I'll try to see if there is anything readily available in the Windows APIs and will post here if that is the case.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 5
(2,832 Views)

And here is the function to query the status. BUT!!!!

This returns the status of the print spooling queue, not the physical status of the printer. The queue only knows about any error condition in the printer after it tried to send at least one job to the printer. And suppose this job did end successfully by using the last paper (or toner) in the printer or before the printer went offline, you won't see the status of this before you actually attempt to send another job to the print queue.

And no, unless you know the exact printer protocol yourself there is no way to determine this through standard Windows means, as every printer uses different proprietary protocols to query all the status information directly rather then by trying to send it a job (if it even has such a functionality).

 

WIN Printer Status.png

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 5
(2,823 Views)

hello, and thanks for your help

 

i need have a look at the printer status (enabled-disabled) in order to display a dialogbox "beware, the selected printer is not active"

 

 

I'm open to any solution......

Pierre FCentum TNS, Grenoble
Certified LabVIEW Associated Developer
0 Kudos
Message 5 of 5
(2,808 Views)