?
Solved

Printer Status using MFC or SDK ...

Posted on 1998-12-23
5
Medium Priority
?
420 Views
Last Modified: 2013-11-20
How do I get the status of the printer using MFC or SDK ? I should be able to see if the printer is active, idle, powered off etc.
0
Comment
Question by:ganeshokade
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 300 total points
ID: 1326646
Use 'OpenPrinter()' to retrieve a handle to the specified printer. Then call 'GetPrinter()' to request a PRINTER_INFO_*' (preferrably 'PRINTER_INFO_5') structure that holds the information the system 'knows' about the printer (e.g. 'PRINTER_ATTRIBUTE_WORK_OFFLINE' etc.)
0
 
LVL 86

Expert Comment

by:jkr
ID: 1326647
Ooops - 'PRINTER_INFO_2' should work for you also, but you'll better take a look at all structures to find out what fits your needs better ;-)
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1326648
Two knowledge base articles will help you with this:

Q160129
Q158828

It would be pointless to repeat the articles here, they are well written and starting there can get you almost anything out of the print drivers/spoolers, etc...

To find those articles you can go to Microsoft's site in the search section. Click on the Knowledge Base radio button and search the article number.
0
 

Author Comment

by:ganeshokade
ID: 1326649
I found both jkr's and plaroche's answer very helpful. But I have one small problem. The two articles quoted above mention that it is possible to get the physical printer status only if the spooler is sending a print job to the printer. Can you give me a trick by which I can get the physical printer status whenever I want to ?
0
 
LVL 86

Expert Comment

by:jkr
ID: 1326650
Well, as the article states:
>>Consequently, a system Printer reports no status when the
>>Printer queue is empty
The easiest way to get around this would be to add a 'dummy' job to the queue before you retrieve the status and using 'SetJob( ..., JOB_CONTROL_CANCEL);' to delete it afterwards instead of calling 'ScheduleJob()'...
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question