Share via


Registering Your Context Menu Handler

banner art

Previous Next

Registering Your Context Menu Handler

In order for your context menu handler to be recognized by the WPD namespace you must register it properly in the Windows registry. The registration entries for a WPD context menu handler are similar to those for the shell, but they are registered as special file types. WPD context menu handlers are registered according to the content type they represent. Below is a sample registration tree for a WPD context menu handler:

  HKEY_CLASSES_ROOT
 \-- WPDContextMenu.Image
      \-- shellex
           \-- ContextMenuHandlers
                \-- ShImageViewer (Default)  REG_SZ {E847DA7C-1D6A-45F6-B725-CB260C236066}

The above example registers the shell image viewer with the WPD namespace. When a user right-clicks or double-clicks content on a device through the Windows Vista Shell, it invokes this context menu handler. The WPD namespace uses WPD_CONTENT_TYPE to determine which context menu handlers to load. If WPD_CONTENT_TYPE is equal to WPD_CONTENT_TYPE_UNSPECIFIED, WPD_CONTENT_TYPE_GENERIC_FILE or WPD_CONTENT_TYPE_PROGRAM, then the WPD namespace will try to find the best match based on the extension of the selected file. If neither the file extension nor the content type provides a useful classification, the WPD namespace will load the context menu handlers under the WPDContextMenu.Generic registry key. The following table lists all of the file classes available to a context menu handler and what content types and file extensions they represent:

Registry Key WPD Content Type File Extension
WPDContextMenu.Device Registering under this key enables your context menu handler at the device level. (Right-click on a device.) (N/A)
WPDContextMenu.Storage Registering under this key enables your context menu handler at the storage level. (Right-click on a storage.) (N/A)
WPDContextMenu.Folder WPD_CONTENT_TYPE_FOLDER (N/A)
WPDContextMenu.Image WPD_CONTENT_TYPE_IMAGE .bmp

.gif

.png

.jpg

.jpe

.jpeg

WPDContextMenu.Audio WPD_CONTENT_TYPE_AUDIO .aiff

.mp3

.wav

.wma

WPDContextMenu.Video WPD_CONTENT_TYPE_VIDEO .asf

.avi

.dvr-ms

.mpeg

.mpg

.wmv

WPDContextMenu.Playlist WPD_CONTENT_TYPE_PLAYLIST .wpl

.m3u

.mpl

.asx

.pls

WPDContextMenu.Document WPD_CONTENT_TYPE_DOCUMENT .doc

.txt

.rtf

.xls

.ppt

WPDContextMenu.Contact WPD_CONTENT_TYPE_CONTACT None
WPDContextMenu.Email WPD_CONTENT_TYPE_EMAIL None
WPDContextMenu.Appointment WPD_CONTENT_TYPE_APPOINTMENT None
WPDContextMenu.Task WPD_CONTENT_TYPE_TASK None
WPDContextMenu.Memo WPD_CONTENT_TYPE_MEMO None
WPDContextMenu.ImageAlbum WPD_CONTENT_TYPE_IMAGE_ALBUM None
WPDContextMenu.AudioAlbum WPD_CONTENT_TYPE_AUDIO_ALBUM None
WPDContextMenu.VideoAlbum WPD_CONTENT_TYPE_VIDEO_ALBUM None
WPDContextMenu.MixedAlbum WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM None
WPDContextMenu.Generic WPD_CONTENT_TYPE_UNSPECIFIED All other file extensions
Previous Next