Prev: Strange USB-Audio streaming behaviour of DPC
Next: MFT DataSize, AllocatedSize and LastWriteTime Options
From: Timothy Jewett on 27 May 2010 16:45 I am trying to wite a service that will detect when a USB storage device is inserted to display a warning message. I have written the service that detects USB device insertions but I get my message when any USB device is inserted. I would like to narrow that down to just storage devices, thumb drives and external hard disks... Can someone point me in the correct direction as to how I can narrow that down ? Thanks, -- Timothy Jewett Jewettware(a)online.nospam
From: Pavel A. on 27 May 2010 23:15 "Timothy Jewett" <jewettware(a)online.nospam> wrote in message news:AA0B3A4C-4DBB-4C96-A1C3-2AF82B62A2F2(a)microsoft.com... > I am trying to wite a service that will detect when a USB storage device > is > inserted to display a warning message. I have written the service that > detects USB device insertions but I get my message when any USB device is > inserted. I would like to narrow that down to just storage devices, thumb > drives and external hard disks... > > Can someone point me in the correct direction as to how I can narrow that > down ? > > Thanks, > -- > Timothy Jewett > Jewettware(a)online.nospam When you register for hardware change notification, maybe you specify a wrong id in the filter. You need DBT_DEVTYP_VOLUME, or DBT_DEVTYP_DEVICEINTERFACE with class = DiskDrive or Volume. -- pa
From: Microsoft Corporation on 1 Jun 2010 08:16 //Add these code to the initialization part DEV_BROADCAST_HDR NotificationFilter; NotificationFilter.dbch_size = sizeof(DEV_BROADCAST_HDR); NotificationFilter.dbch_devicetype = DBT_DEVTYP_VOLUME; hDevNotify = RegisterDeviceNotification(hMainWnd, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE); ///<\Custom Initialization Code> //Application_Run(), can also be a message loop. UnregisterDeviceNotification(hDevNotify); //So that you can get notifications only when Mass Storage Device is inserted. ----- Original Message ----- From: "Timothy Jewett" <jewettware(a)online.nospam> Newsgroups: microsoft.public.win32.programmer.kernel Sent: Friday, May 28, 2010 04:45 Subject: USB Storage Device Detetcion >I am trying to wite a service that will detect when a USB storage device is > inserted to display a warning message. I have written the service that > detects USB device insertions but I get my message when any USB device is > inserted. I would like to narrow that down to just storage devices, thumb > drives and external hard disks... > > Can someone point me in the correct direction as to how I can narrow that > down ? > > Thanks, > -- > Timothy Jewett > Jewettware(a)online.nospam
From: Timothy Jewett on 4 Jun 2010 15:23 I tried your example and I get a 0x42A returned from RegisterDeviceNotification(), any idea ? -- Timothy Jewett Jewettware(a)online.nospam "Microsoft Corporation" wrote: > //Add these code to the initialization part > > DEV_BROADCAST_HDR NotificationFilter; > NotificationFilter.dbch_size = sizeof(DEV_BROADCAST_HDR); > NotificationFilter.dbch_devicetype = DBT_DEVTYP_VOLUME; > > hDevNotify = RegisterDeviceNotification(hMainWnd, &NotificationFilter, > DEVICE_NOTIFY_WINDOW_HANDLE); > > ///<\Custom Initialization Code> > > //Application_Run(), can also be a message loop. > > UnregisterDeviceNotification(hDevNotify); > > //So that you can get notifications only when Mass Storage Device is > inserted. > > > ----- Original Message ----- > From: "Timothy Jewett" <jewettware(a)online.nospam> > Newsgroups: microsoft.public.win32.programmer.kernel > Sent: Friday, May 28, 2010 04:45 > Subject: USB Storage Device Detetcion > > > >I am trying to wite a service that will detect when a USB storage device is > > inserted to display a warning message. I have written the service that > > detects USB device insertions but I get my message when any USB device is > > inserted. I would like to narrow that down to just storage devices, thumb > > drives and external hard disks... > > > > Can someone point me in the correct direction as to how I can narrow that > > down ? > > > > Thanks, > > -- > > Timothy Jewett > > Jewettware(a)online.nospam > > > > . >
From: Timothy Jewett on 9 Jun 2010 17:32 I did figure out the 42a was because you cannot register for a broadcast volume. I do receive the broadcast volume on thumb drives but do not receive anything for CD/DVD media insertion. Is ther some other method to receive the change for media on cd/dvd devices ? -- Timothy Jewett Jewettware(a)online.nospam "Microsoft Corporation" wrote: > //Add these code to the initialization part > > DEV_BROADCAST_HDR NotificationFilter; > NotificationFilter.dbch_size = sizeof(DEV_BROADCAST_HDR); > NotificationFilter.dbch_devicetype = DBT_DEVTYP_VOLUME; > > hDevNotify = RegisterDeviceNotification(hMainWnd, &NotificationFilter, > DEVICE_NOTIFY_WINDOW_HANDLE); > > ///<\Custom Initialization Code> > > //Application_Run(), can also be a message loop. > > UnregisterDeviceNotification(hDevNotify); > > //So that you can get notifications only when Mass Storage Device is > inserted. > > > ----- Original Message ----- > From: "Timothy Jewett" <jewettware(a)online.nospam> > Newsgroups: microsoft.public.win32.programmer.kernel > Sent: Friday, May 28, 2010 04:45 > Subject: USB Storage Device Detetcion > > > >I am trying to wite a service that will detect when a USB storage device is > > inserted to display a warning message. I have written the service that > > detects USB device insertions but I get my message when any USB device is > > inserted. I would like to narrow that down to just storage devices, thumb > > drives and external hard disks... > > > > Can someone point me in the correct direction as to how I can narrow that > > down ? > > > > Thanks, > > -- > > Timothy Jewett > > Jewettware(a)online.nospam > > > > . >
|
Next
|
Last
Pages: 1 2 Prev: Strange USB-Audio streaming behaviour of DPC Next: MFT DataSize, AllocatedSize and LastWriteTime Options |