|
From: Stephan M. <ste...@we...> - 2007-02-23 17:37:28
|
Have a look this source code: http://libusb-win32.cvs.sourceforge.net/libusb-win32/libusb/src/service/service_nt.c?hideattic=0&revision=1.5&view=markup This is the source of a service that was part of older versions of libusb-win32. It does what you need. Basically, you have to do the following: * use RegisterDeviceNotification() to activate device notification events * listen to SERVICE_CONTROL_DEVICEEVENT (service) or WM_DEVICE_CHANGE (normal app) events * use libusb to rescan the whole bus for new devices * open new devices Stephan > I'm not sure if this is the correct place to ask this or not, but how > do I detect when a usb device is plugged in? I've successfully created > an .inf file to bind my device to the libusb-win32 driver. I also have > an application that uses the libusb dll to interact with my device. > I'm planning on turning that application into a service, but I need to > execute some code whenever a device is plugged in. How can I detect > when someone plugs in one of my devices? Or is there a better way to > organize this? > > -Joseph > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Libusb-win32-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel > _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066 |