Export (0) Print
Expand All
22 out of 32 rated this helpful - Rate this topic

Extending the Windows Live Photo Gallery More Tools Menu

The More Tools menu appears in the Create tab of the Windows Live Photo Gallery menu bar, and lists applications that can be used to open files from Windows Live Photo Gallery. The menu can be extended to include custom items that open files by means of an external application. An application that appears on the More Tools menu is called an extensibility application.

The More Tools menu also supports groups, which appear as categories in the menu.

This topic explains how to add items to the More Tools menu, and the requirements that must be met by the supporting extensibility application.

Windows Live Photo Gallery uses COM drag and drop data transfer to pass selected media files to an extensibility application. An extensibility application must be a registered COM server that implements the IDropTarget interface. A 32-bit COM server can be either in-process or out-of-process; a 64-bit com server must be out of process.

For more information about COM data transfer, see Data Transfer. For more information about registering a COM server, see Registering COM Applications.

.NET Application Requirements

To make a .NET class visible as a COM drop target, follow these steps:

  1. Indicate that the class is a drop target by setting the class's AllowDrop property to true, and specifying a handler for the Drop event. For more information, see AllowDrop Property and Drop Event.
  2. Generate a GUID for the drop target class. The Visual Studio Create GUID tool (guidgen.exe) provides an easy way to generate GUIDs. For more information, see Create GUID.
  3. Add the following attribute to the class definition, replacing xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with your class's GUID:
[Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx "), ComVisible(true), CLSCompliant(false)]

Windows Live Photo Gallery determines the how items are displayed in the More Tools menu by enumerating registry keys in the following location:

HKEY_LOCAL_MACHINE\
   SOFTWARE\
      Microsoft\
         Windows Live\
            Photo Gallery\
               Extensibility

Each item that appears in the More Tools menu is defined by a registry key; the name of the key must by the CLSID of the corresponding extensibility application.

HKEY_LOCAL_MACHINE\
   SOFTWARE\
      Microsoft\
         Windows Live\
            Photo Gallery\
               Extensibility\
                  {extensibilty application CLSID}

For example, an extensibility application with a CLSID of ee7b7d54-5cec-463d-8608-4cf594475531 would use the following registry entry:

HKLM\SOFTWARE\Microsoft\Windows Live\Photo Gallery\Extensibility\{ee7b7d54-5cec-463d-8608-4cf594475531}

An extensibility application's key also contains string values that define how the application is presented in the More Tools menu. The following values are supported:

  • ApplicationName - Specifies a friendly name for the extensibility application; if there is an error, this name appears on the error dialog box. The specified ApplicationName value also appears as a category name in the More Tools menu. REG_SZ; required.
  • MenuText - Specifies a menu item that appears in the More Tools menu if no SubMenu items are specified. REG_SZ; required.
  • SubMenu – Specifies a menu item that appears in the ApplicationName category on the More Tools menu. REG_SZ; optional.
Cc967061.note(en-us,WIN.10).gifNote:
The maximum supported length for these registry values is 127 characters.

To help support language-neutral implementations, string values may be specified directly or with a standard resource file/ID reference. The following example specifies a resource file named example.dll and a string resource ID of -22919 for the application name:

…\ApplicationName\example.dll,-22919

Ensuring a Clean Uninstall

When an extensibility application is uninstalled, it is important to remove all extensibility-related registry entries. If an extensibility application is uninstalled but does not remove its extensibility entries from the registry, menu items for which there is no supporting application may still appear in the More Tools menu, resulting in a confusing user experience.

Example: Adding a Single Item to the Extras Menu

This registry entry example shows how add a single item to the More Tools menu.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Live\Photo Gallery\Extensibility\{F64894F0-FF39-463e-B04B-9ED4B37AA28E}]
"ApplicationName"="Your Extensibility Application"
"MenuText"="Open with Your Extensibility Application"

Example: Grouping Items in the Extras Menu

The following registry example shows how add multiple grouped items to the More Tools menu. In this example, the specified items are grouped together in a category in the Your Extensibility Tools menu.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Live\Photo Gallery\Extensibility\{0462E00D-EFE1-4897-B615-2C901B14DAF0}]
"ApplicationName"="Your Extensibility Tool-X"
"MenuText"="Open with Your Extensibility Tool-X"
"SubMenu"="Your Extensibility Tools"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Live\Photo Gallery\Extensibility\{33E123F1-2AE7-4f2a-B3CE-4AF2B0CB2895}
"ApplicationName"="Your Extensibility Tool-Y"
"MenuText"="Open with Your Extensibility Tool-Y"
"SubMenu"="Your Extensibility Tools"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Live\Photo Gallery\Extensibility\ {B31DC737-385A-4a3b-B39C-5B4167D3F342}]
"ApplicationName"="Your Extensibility Tool-Z"
"MenuText"="Open with Your Extensibility Tool-Z"
"SubMenu"="Your Extensibility Tools"

When a user selects an item from the More Tools menu, Windows Live Photo Gallery performs the following steps:

  1. Windows Live Photo Gallery gets an IDropTarget interface for the extensibility application by calling CoCreateInstance with the application's CLSID.
  2. Photo Gallery calls the IDropTarget::DragEnter method to determine whether a drop can be accepted.
  3. Selected photos and videos are added to an IDataObject object, which is passed to the extensibility application by calling IDropTarget::Drop.

The following code snippet shows how to extract file paths from an IDataObject.

HRESULT YourExtensibilityApp::Drop(__in IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, __inout DWORD* pdwEffect) {

   FORMATETC format = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
   STGMEDIUM medium;

   *pdwEffect = DROPEFFECT_COPY;

   // medium.tymed == TYMED_HGLOBAL
   FORMATETC format = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
...

   HDROP hDropInfo = reinterpret_cast<HDROP>(::GlobalLock(medium.hGlobal));

   CAtlString strFiles;
   UINT uFileCount = ::DragQueryFile(hDropInfo, static_cast<UINT>(-1), NULL, 0);

   for (UINT uIndex = 0; uIndex < uFileCount; uIndex++)
   {
      WCHAR szFileName[MAX_PATH];

      ::DragQueryFile(hDropInfo, uIndex, szFileName, ARRAYSIZE(szFileName));

   strFiles += szFileName;
   strFiles += L"\n";
   }

...

   ::GlobalUnlock(medium.hGlobal);
   ::ReleaseStgMedium(&medium);

   return S_OK;
}

Windows Live Photo Gallery does not limit the number of photo or video files that the user can select; whenever at least one file is selected, all items on the More Tools menu are enabled. Similarly, Windows Live Photo Gallery does not limit the format of items that the user can select. An extensibility application must be prepared to gracefully handle any number of photo and video files, and in any combination of formats. In cases where the user selects files that the application cannot handle, the extensibility application is responsible for informing the user about the limitation.

If the process of launching an extensibility application fails, Windows Live Photo Gallery presents a dialog indicating that there was an error.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.