tags:

views:

187

answers:

2

In Delphi 2010, I want to allow users to browse and select a folder. The folder is on a device (?) created by a DSLR:

Image of folder

The folder is visible in the Windows Explorer as shown above. And, the folder is visible in a TOpenDialog, allowing them to browse into the folder and choose a file.

Unfortunately, I have been unable to get either SHBrowseForFolder (code I found on the web but don't understand) or SelectDirectory to see the camera device or folder beneath it. (Side note: IMO, SelectDirectory is a far nicer UI, since the user can see the files in the folders while browsing.)

I assume this has to do with the fact that the folder is in a device (?) created by the camera software.

I've seen some tricks where you call TOpenDialog to browse for folders with '*.' and then ExtractFileDir on the result, but that's not robust or, IMO, a good UI.

What I'm looking for is a "Browse for folder" that can see the same devices (including the camera device) the TOpenDialog & Windows Explorer can see. (Ideally, it would have the nice appearance like the one below!)

Any suggestions?

Image of a MS-Word's folder browsing in Win7. (I wonder if it looks this pretty in XP!)

Image of MS-Word folder browsing

A: 

It's because its a special device, not a fixed drive or flash drive. I have had this problem alot before. You have to save to somewhere and the copy with explorer.

Neb
That's a shame - Is delphi not aware of hot-pluggable devices?
KevinDTimm
>> Is delphi not aware of hot-pluggable devices? Well, clearly *some* components Delphi uses can see hot-pluggable devices, since TOpenDialog sees the camera.
Robert Frank
A: 

The folder you're seeing in there is drawn up by a extension to Windows Explorer, it's not an "drive". It's there so you can easily copy stuff in and out of the device Using Windows Explorer. All operations are probably handled by the Windows Explorer Extension. Think of it this way: What PATH would the file on that device have? Without a PATH to the file you can't really open it from any Windows application!

Go into the menu of your DSLR camera, find the setting that tells it what to do when connected via USB to the PC and change that to "Storage Device" (anything that doesn't look proprietary, you probably have 2 or 3 options). By default your DSLR is set to an mode that allows it to talk to camera-automation software running on the PC! Once you change that setting to "storage device" Windows will treat it like any other USB storage device, will assign it a drive letter and you'll be able to access it from your Delphi application. Or do what most DSLR owners do, take out the card out of your DSLR and put it into your card reader.

Edit: From the name in the picture, you've got a Canon 350D camera. Go to the rightmost settings menu, find the Communication option, set it to "PC Connection". The default is: "Print/PTP". If you really want to work with a camera over the Print/PTP protocol, you most likely can, but you need to look for specific API's, because in that mode your camera's storage doesn't map into your file system, so you can't open stuff as files and folders.

Cosmin Prund
Thanks, Cosmin. With the term PTP from your post, I was able to find a Delphi component that is supposed to be able to read (some) Canon cameras: http://alkenius.no-ip.org/TCamRemote/. I have not tried it.I also found a program that claims to allow one to assign a drive letter to a PTP device: www.ptpdrive.com. Beautiful web site, but the installer crashes when registering a dll. The vendor has failed to respond to an email... It's a promising program, if it would just work!PS For your info, the camera's PTP files were browsable in the Windows Explorer. It did not require IE..
Robert Frank
Oh, my mistake, I didn't want to say Internet Explorer, I wanted to say Windows Explorer. I'll edit my answer to reflect that.
Cosmin Prund
About www.ptpdrive.com: That's not for DSLRs as DSLRs can be configured to show up as mass-storage devices when connected via USB. Why would anyone pay money for a hack when they can flip a setting on the camera and get the same thing (a drive letter) natively, no hacks involved? I assume that software's for the minority of cameras (are there any?) that only support PTP.
Cosmin Prund