Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5209
  • Last Modified:

Identifying a printer offline/online status for a local/network printer

I have used PRINTER_INFO_2 structure and GetPrinter for the same. However,it always returns a status of ready even when the physical printer is powered off.
Please suggest me an idea to identify Printer online status for a line printer.
I do not want to use drWrite to check this , as it might also be a network/shared printer.
In which case,drWrite might always return offline.
Suggest me some code snippets.
Thanks in advance.
0
Priya_Kumar
Asked:
Priya_Kumar
1 Solution
 
hdhondtCommented:
When you say local/network printer, I assume this is a printer plugged into a PC, and shared. In that case, the status is the status of the queue, which is always ready to accept jobs. If the printer is not online, the jobs are held until the printer is back.

If you have a networked printer (with a built-in network card), you can ping the printer. No reply means the printer is off or not connected.
0
 
Priya_KumarAuthor Commented:
Can you suggect me some code in C++ to get the status of the queue for a printer that is plugged into a PC and shared.
0
 
Glen A.IT Project ManagerCommented:
Priya, I'd suggest asking that question in one of the programming TA's, you may get better response.

If you'd like to do that, I can close this Q. for you, just let us know.
0
 
MerrionCommented:
The status bit in the PRINTER_INFO_2 is only updated when the print spooler attempts to write to the printer therefore if no jobs are stuck in the queue it always reports status = 0 (Ready).

Some printers allow you to query the status using a special escape sequence and others support the NMTP protocol...suggest you consult your printer manufacturer's developer documentation.  
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now