Anyone know how i can detect when a usb device is plugged in. when the device is plugged in should check to see if the following file exists in the device:
thefile.txt
If this file exists it should show a message box. If it does not exist it should do nothing.
you can use the Win32_LogicalDisk WMI class and check for DriveType of "2" which is removable disk. This will also pull up floppy disk drives, and to not include those, you can also check for the MediType property, if it equals "0", then the media is unknown. If a floppy drive, the media type will be found, and not return 0... (at least, this was tested on my USB drive)
You can check out my sig for the WMI codebank submission for an example of using WMI...