Reputation: 1942
I am working on a WinRT Component, which is written in C++/CX. In the C# side, I get a StorageFile from CameralRoll then I pass file.Path to the WinRT component. How can I read the file data to IInputStream from the url ?
The url C# file.Path:
file:///C:/Data/Users/Public/Pictures/Camera%20Roll/04ede9ed-dafe-4d32-902a-206baa28006b.gif
Upvotes: 0
Views: 513
Reputation: 21899
You need to pass and use the StorageFile. You cannot extract and use the path. The app doesn't have permissions to read the path. It must go through the StorageFile to access locations outside of its app data and install directories.
See my blog entry at http://blogs.msdn.com/b/wsdevsol/archive/2012/12/05/stray-from-the-path-stick-to-the-storagefile.aspx for more details.
Alternately you can open the StorageFile on the C# side and pass the stream to the component.
Upvotes: 2