Official blog for the Windows Live Digital Memories
Windows Photo Gallery provides an easy launching point for users to open pictures and videos with their favorite applications. If you’re a developer of an image or video application, here’s how you can integrate your app with Windows Photo Gallery.
Windows Photo Gallery provides two places where the user can launch other applications. One is the 'Open' menu, available by pressing the 'Open' button on the command bar. The other is the 'Open With' item on the context menu, available by right-clicking an item in the gallery
How it works
Windows Photo Gallery uses the shell’s standard mechanism for identifying applications that are registered as handling files with given extensions. For your app to show up in the 'Open With' list for a particular file type (.JPG, for example), your installer will need to create the appropriate registry keys to register your app as a recommended handler for that type of file. For details, see the MSDN documentation for Creating a File Association. Additional useful documentation is under Arbitrary File Types.
The advantage of setting up the proper registry keys in your installer is that not only will your app appear in Windows Photo Gallery’s menus, but it will also show up in the shell’s own 'Open With' menu (for example, when you right-click on an item in Explorer).
Working with multi-select
Windows Photo Gallery also supports multi-select; you can select multiple items, and open them all at once with the same application. For example, if you select three videos and drop down the 'Open' Menu, you’ll see Windows Media Player in the menu—and if you select it, it will launch with those three videos in a playlist.
There are two ways that your app can support multi-select in Windows Photo Gallery.
The first way is if your app happens to be the app associated with the default shell verb (e.g. “open,” “play,” etc.) for the selection, and implements a drop target. For details, see Verbs and File Associations on MSDN, specifically the discussion of DropTarget in the section entitled “How the Shell Invokes Verbs.”
If you want your app to support multi-select without being the primary app associated with the file type, then the steps are somewhat more involved. The MSDN article File Types mentions briefly what is needed, but some additional description may be helpful, so please see the example below.
Example 1: Supporting .JPG with multi-select
Suppose you want your app to support opening multiple .JPG images at once. You could register it as the target of the shell’s “open” verb for .JPG files, but suppose you don’t want to do that; you merely want to be available as an “open with” option. Here’s what you do:
Step 1: Create a PROGID.You need to create a PROGID for your application for the specific file type. Suppose your app is called MyApp.exe, and you decide on the name MyAppImageFile as your PROGID. You would need the following registry keys:
HKEY_CLASSES_ROOT MyAppImageFile shell open command (Default) = your app’s command string (type: REG_SZ or REG_EXPAND_SZ) DropTarget CLSID = your drop target’s CLSID (type: REG_SZ)
Step 2: Register your PROGID with the file extensions you want to supportFor each file extension you want to work with your app, you need to add it as a value to the extension’s OpenWithProgIds key. In this example, you want your app to work with .JPG files, so you would add the following value:
HKEY_CLASSES_ROOT .jpg OpenWithProgIds MyAppImageFile (type: REG_NONE)
If you want to support other extensions as well, you could add OpenWithProgIds values to those extensions, all pointing at your PROGID.
Example 2: Supporting .JPG and .PNG multi-select in Windows Media Player
Windows Media Player happens to be able to open image files such as .JPG and .PNG, even though it’s not registered as the primary handler for those file types. We can enable it as a multi-select-enabled app for those image types by following the steps described above. Paste the following text into a .reg file and double-click it in Explorer; having done so, Windows Media Player will now show up as an option on the Open With menu in Windows Photo Gallery, if you have multiple .JPG and/or .PNG files selected. I’ve arbitrarily picked “ImageFileForWmp” as the PROGID to use.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ImageFileForWmp\shell\open\command]@=hex(2):22,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,\ 00,65,00,73,00,25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,\ 4d,00,65,00,64,00,69,00,61,00,20,00,50,00,6c,00,61,00,79,00,65,00,72,00,5c,\00,77,00,6d,00,70,00,6c,00,61,00,79,00,65,00,72,00,2e,00,65,00,78,00,65,00,\ 22,00,20,00,2f,00,70,00,72,00,65,00,66,00,65,00,74,00,63,00,68,00,3a,00,36,\00,20,00,2f,00,4f,00,70,00,65,00,6e,00,20,00,22,00,25,00,4c,00,22,00,00,00
- Bryan Beatty (Software Development Engineer)