Re: Grey out the icon of offline printer
- From: "Namit Bhalla" <natkhatbandar@xxxxxxxxx>
- Date: 15 Sep 2006 22:01:46 -0700
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);
--------------------------------------------------------------------------------
.
- References:
- Grey out the icon of offline printer
- From: Namit Bhalla
- Re: Grey out the icon of offline printer
- From: Vipin
- Grey out the icon of offline printer
- Prev by Date: Re: Uses for Screen OCR Technology ???
- Next by Date: Re: GetDCEx( hwnd, NULL, 0 ) vs. GetDC( hwnd )
- Previous by thread: Re: Grey out the icon of offline printer
- Next by thread: LoadBitmap and SelecObject
- Index(es):
Relevant Pages
|