0

I'm building a windows app that views pictures on a camera (removable device) without copying them to disk.

Problem with most cameras connected through USB is that their path is relative to MyComputer, which is a virtual path and thus contains no drive letter (cf. C:\).

Using "Computer\[Camera Name]\Removable storage\AnotherDirectory\" as a path makes the compiler think I'm using the relative path: ...\Project\bin\Release\Computer\[Camera Name]\Removable storage\AnotherDirectory\

I've found a previous question on Using FolderBrowserDialog on a Removable Device / Removable storage but I'm not accustomed to COM shell interfaces and was wondering if there is a way of just telling the compiler the given path is absolute?

Update

Answering Richards question on how the pictures are read,

first I gather the paths of all jpg in a sequence. then I map that sequence with the function beneath:

let loadPic path= 
    let bitmap = new BitmapImage()
    if System.IO.File.Exists path then
        bitmap.BeginInit()
        bitmap.UriSource <- Uri(path)
        bitmap.CacheOption <- BitmapCacheOption.OnLoad
        bitmap.EndInit()
    bitmap

Resulting in a sequence of bitmaps which can then be viewed.

Community
  • 1
  • 1
Funk
  • 10,976
  • 1
  • 17
  • 33
  • There is, at an API level, as "path is relative to MyComputer" except within the Shell namespace (which builds on top of, and massively extends the file systems namespace). You would be better describing how you programmatically read image data from the camera... – Richard Mar 09 '16 at 14:28

1 Answers1

1

They aren't enumerated as disks. It's something different.

Try this:

https://github.com/geersch/WPD/blob/master/src/part-3/README.md

This one has code examples on how to access MTP devices:

https://bitbucket.org/derekwilson/podcastutilities/src/b18a9926c1dcbfb884b34b9865ebaec96abfdb82/PodcastUtilities.PortableDevices/?at=default

Hope it helps!

Christophe Geers
  • 8,564
  • 3
  • 37
  • 53
Octanic
  • 133
  • 7