Using FolderBrowserDialog on a Removable Device / Removable storage
Asked Answered
C

3

4

I'm working on a simple copy tool to copy files off digital cameras. I've written the file copy code, I've got everything hooked up nicely.

The issue I have seems to be with the FolderBrowserDialog. In Vista (I haven't checked XP yet), I can browse to the directories on the camera. However the FolderBrowserDialog will not let me select a directory on the camera. The OK button is greyed out.

Looking at the path for the files on the camera it looks like this:

Computer\[Camera Name]\Removable storage\AnotherDirectory\

As this is not a valid path (intead of C:\whatever), I'm guessing the FolderBrowserDialog doesn't like this.

It works fine from a valid path name, but not off the camera...

Does anyone have any suggestions to get around this?

Update

To confirm oefe's question the path is actually displayed as:

Computer\[Camera Name]\Removable storage\AnotherDirectory\

ChulioMartinez's suggestion of using SHBrowseForFolder does work, and I will mark as the correct answer. Thanks for your help Chulio.

Crossroads answered 12/2, 2009 at 13:37 Comment(1)
How do you get the actual path ? SHBrowseForFolder returns me a valid PIDL but SHGetPathFromIDList fails to return me the path. It works with non-MTP paths but not with MTP paths.Sexcentenary
L
3

My guess would be that the location doesn't have a file system representation (path) such as c:...\my camera.

You should be able to get the PIDL of the folder, (it should be one the the flags for the function), and implement the copy using the COM shell interfaces.

SHBrowseForFolder

Using PIDL to enumerate a folder

Lesser answered 14/2, 2009 at 10:36 Comment(0)
K
0

Is there a way to map the camera path to a drive letter? (I'm thinking something like "subst" or "net use" from a command prompt.) Maybe that would fool the FolderBrowserDialog into behaving as desired?

Khrushchev answered 13/2, 2009 at 20:56 Comment(0)
H
0

Where did you get the path from? From the address bar in Explorer? This doesn't display the file system path, but a "user friendly" representation of it.

To get the path, right-click the address bar, and choose "Copy Address as Text" or "Edit Address".

Helbon answered 15/2, 2009 at 10:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.