- Notification when a USB printer goes off the bus
- Posted by Manfred Wilner on June 3rd, 2004
OS Windows 2000 and XP.
Is there a way to find out when a USB printer is going off the bus?
You can hear the Windows "ding" (at least in XP) when the printer goes
offline or online and I get thread attach and detach messages around the
same time and I noticed that when the printer was offline and went back
online the device path for direct USB access has changed since the
CreateFile comes back with Invalid_Handle.
To not overdue the testing on new device path I would like to know if there
is a Win API which tells me that a device changes it's state (offline or
online).
Thanks in advance.
All help much appreciated.
/Manfred
- Posted by Debabrata Sarma[MSFT] on June 4th, 2004
Hi Manfred,
You may look at the set of APIs SetupDixxx. There are several APIs in this
group
and you will be able to find one or combinations of more than one API to
resolve
you problem. The online docs for SetupDiGetClassDevsEx has some sample code
you may look into.
Thanks.
Deba Sarma
MICROSOFT DDK Print Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
- Posted by on June 4th, 2004
RegisterDeviceNotification()
WM_DEVICECHANGE
"Manfred Wilner" <manfred.w@swecoinus.com> wrote in message
news:uFmjICZSEHA.4032@TK2MSFTNGP11.phx.gbl...