Solved

Printer Status using MFC or SDK ...

Posted on 1998-12-23
5
400 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sumDigits challenge 9 172
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 116
Thin secure Windows 10 5 107
I could not set window to top 4 43
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

733 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