Solved

Printer Status using MFC or SDK ...

Posted on 1998-12-23
5
358 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
  • 3
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 100 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now