[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

detect camera hookup to USB

Does anyone know how to detect when a camera is hooked up to a USB and
retrieve the pictures to a Picturebox or richtextbox?
  • 2
1 Solution
Most new cameras today show the memory card as a drive, you can easily have the software check that drive and load the pictures to a picturebox by setting the image property of the picture box. Accessing the camera is just a matter of creating a path with that drive letter.

Getting the program to detect a connect is slightly more involved. It requires using the WMI interface to listen for usb events to determine when a device is connected, there are several ways to do this, see the question link below. If this is too complicated you could have the program check for the drive and prompt user to connect camera if drive is not present, then when they connect camera try to access drive again and keep prompting until camera is connected or user cancels. This is easy to do with a simple retry message box.

isnoend2001Author Commented:
Thanks for your reply
I am gonna skip the listening for a camera hookup and have a button or nenu item to get pictures from camera. How would i determine the drive the camera is hooked up to?
It would usually be a removable disk so you can check the drive name using the filesystemobject and try to locate it that way, also the file structure on most camera drives is very specific so you can usually determine that the drive is a camera by looking for specific files or folders that the camera creates. I know nikon cameras name their folders DSC_**** or something simlar so you could look for that. You may also scan the drives and then ask the user to connect camera and then rescan and the drive that was not present on first scan is going to be the camera drive.
Forced accept.

EE Admin

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now