Search code examples
c#windowswindows-explorerwindowsphotogallery

How does Windows Photo Viewer get the files for the slideshow from Windows Explorer?


I wrote an image viewer application in C# to replace Windows 7 Photo Viewer which does not have the one feature I needed, which was to set the ratings and keywords directly from the view screen and not by opening some less user-friendly property pages. It works Ok for my need, but I wanted to improve it with a slideshow.

With Windows 7 Photo Viewer, what I usually did was I set the keywords of the picture, I used Windows Explorer "organize by" feature, clicked one keyword, double-clicked one file and run the slideshow from there.

But when I double-click a file from the keyword-"organized" folder in Windows Explorer, all my app gets is the command-line argument, i.e. the full name of the file.

I could admit running my slideshow from there, using System.IO.Path.GetDirectoryName to get all files from the folder, but I find it lacks a certain "panache", don't you think?

I am not asking for code here. But could someone just point me in the right direction, please? I don't know what WindowsExplorer actually gives PhotoViewer that allows it to only show the required files. And why.

Thanks for any help.


Solution

  • When you use Organize by feature of Windows Explorer it creates special virtual folder. And this folder contains files with selected keyword only. Mechanism of opening of PhotoViewer differs from standard way. If you open HKEY_CLASSES_ROOT\jpegfile\shell\open registry key you will see that where is DropTarget subkey. It means when you double-clicked the file shell creates inproc com server with CLSID from DropTarget subkey and pass virtual path of image to IDropTarget instance. So PhotoViewer work with list of virtual objects instead of physical directory.