Re: Grey out the icon of offline printer



Hey Vipin,
Great to find you!
I dont believe you still lurk around these groups!

Starting and stopping spooler does not help. I tried doing..
pPrinterInfo5->Attributes |= PRINTER_ATTRIBUTE_WORK_OFFLINE;
SetPrinter (hPrinter, 5, (LPBYTE)pPrinterInfo5, 0);

It caused the printer icon to be grayed. But whenever I
connect/disconnect the USB cable of the printer, the status
automatically changes to 'ready' and icon becomes un-grayed. Something
in windows (usbmon?) is setting the status to online.

This behavior is consistent with when i manually do a 'Use Printer
Offline' and then connect/disconnect the cable.

Hope to bump into you again!


Vipin wrote:
Hi Namit,
Interesting. Does it appear grayed if you stop and start the
spooler?

--
Vipin Aravind
http://www.explorewindows.com/Blogs


"Namit Bhalla" <natkhatbandar@xxxxxxxxx> wrote in message
news:1158289629.374674.220670@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I wish to set the status of a printer to offline. I was able to do it
using SetPrinter() API (code below). But the icon of the printer in
'Printers and Faxes' folder remains the same. How can I make the icon
gray (dim) programmatically?

Note that when you select 'Use Printer Offline' manually, the icon
becomes gray automatically.

TIA.


Code to set status of printer to offline. I verified that the printer
is actually offline by printing a job. The job was not spooled which
confirmed that the spooler is aware that the printer is offline.
--------------------------------------------------------------------------------------
HANDLE hPrinter = NULL;
PRINTER_DEFAULTS pd;
pd.pDatatype = NULL;
pd.pDevMode = NULL;
pd.DesiredAccess = PRINTER_ACCESS_ADMINISTER;
BOOL bOpen = OpenPrinter(L"HP LaserJet 3050 Series PCL 5e", &hPrinter,
&pd);

PRINTER_INFO_6 pi6;
pi6.dwStatus = PRINTER_STATUS_OFFLINE;
BOOL bSet = SetPrinter(hPrinter, 6, (LPBYTE)&pi6, 0);
--------------------------------------------------------------------------------


.



Relevant Pages

  • Re: Grey out the icon of offline printer
    ... Vipin Aravind ... I wish to set the status of a printer to offline. ... How can I make the icon ... confirmed that the spooler is aware that the printer is offline. ...
    (microsoft.public.win32.programmer.gdi)
  • Grey out the icon of offline printer
    ... I wish to set the status of a printer to offline. ... using SetPrinterAPI. ... How can I make the icon ... confirmed that the spooler is aware that the printer is offline. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: How to trigger server to reattempt printer connection
    ... The spooler will poll the IP or Hostname associated with the port. ... The printer gets placed into Offline Status when the printer fails an SNMP ... back online on the server after it goes offline following a paper jam ...
    (microsoft.public.windows.server.general)
  • Re: TaskTray says printing queue is stuck
    ... But when I delete the job from the printer spooler ... Refreshing the print jobs folder), the tasktray icon still shows ... I ran a simple print job through successfully. ...
    (microsoft.public.windowsxp.general)
  • Re: TaskTray says printing queue is stuck
    ... But when I delete the job from the printer spooler ... Refreshing the print jobs folder), the tasktray icon still shows ...
    (microsoft.public.windowsxp.general)

Quantcast