How can I read files from a camera attached via usb

In C# how can I copy a file from a camera to my local drive? The camera is connected via USB and it does not show up as a standard drive.

I am using a Sony Handycam HDR-CX160. I want to write a small c# windowsform app that copies the video files from the device.

So how does my app copy files from the device connected via usb? It does not show up as a drive but it shows up in windows explorer. When I search drives in C# it is not in the list?

Thanks!

======== UPDATE =======

I am going to try and ask this question a different way and hopefully it will get reopened.

Using C# I need to copy a file from a camera to my local hard drive. If I new the path this line of code would do it.

string cameraPath = ?????
string sourcePath = Path.Combine(cameraPath, @"Video2012-1-1.WMV");
string targetPath =  @"C:Video2012-1-1.WMV";
System.IO.File.Copy(sourceFile, destFile, true);

So how can I resolve the cameraPath? Is there another way to do this all together?


I don't know the specifics about your device and the best bet is probably to use the software that came with your device.

However, if a digital camera doesn't present itself as a drive that you can read files from it may support Windows Image Acquisition . The easiest way to use that from C# is to use Windows Image Acquisition Automation Layer. Scott Hanselman has an old Coding4Fun article Look at me! Windows Image Acquisition on Channel 9.

If you are able to remove the flash memory card from the camera you can also try to read this card using a card reader to get direct access to the files.

Also, if you want to run your application when you connect the camera you need to register an AutoPlay event handler. There is an event for when a camera is connected.

链接地址: http://www.djcxy.com/p/62356.html

上一篇: 干净地改变SVG路径

下一篇: 我如何从通过USB连接的相机读取文件