IContextMenu::InvokeCommand Method Carries out the command associated with a shortcut menu item.
Adding items to Explorer Shell context menu easily – How to add ? Add an item to Windows Explorer context menu easily with Windows Explorer Context Menu. This powerful .Net component for your own, custom items appending to Explorer Shell context menu will add all your custom application entries to Explorer Shell context menu. It and VB.NET support include detailed C# / VB.NET samples, tutorials and support all you may need : - Add items to Windows Explorer context menu to be shown on any Windows computer (all operating systems are supported – Windows XP, Vista, x64 , etc.)
- Add items to Windows Explorer Shell context menu to be shown in any way - with custom caption and your custom icon, as separator or sub-menu
- Add items to Windows Explorer context menu to be shown for all files or shown only for files of particular type (for example, only for .PDF .TXT , .MP3,.WMA,.AAC , .AVI files)
- Add items to Windows Explorer Shell context menu, sub-menus, sub-sub-menus, sub-menus of unlimited depth and even more
Explorer Shell Context Menu - is a .Net framework component that support all you may need to insert all your program items to the Windows Explorer Shell context menu - in a fast and easy way. Add your application items to Windows Explorer context menu right now – add items to context menu fast , easy and exactly as you prefere :
InvokeCommand is a method for any command, such as executable file execution, also used in old operating systems from Windows family to add items to Explorer context menu, because this method may be used for aitems appending to Explorer context menu only for Windows 95 / Windows 98 (not on XP, Vista, x64 - 64-bit Windows), to add items to Windows Explorer Shell context menu you should use, according to Microsoft guidelines, appropriate .Net component - Windows Explorer Context Menu. It will help to add your items to Explorer Shell context menu in a very easy way. Syntax
HRESULT InvokeCommand( LPCMINVOKECOMMANDINFO pici ); Parameters
pici A pointer to a CMINVOKECOMMANDINFO or CMINVOKECOMMANDINFOEX structure containing information about the command. For further details, see the Remarks section.
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
The IContextMenu interface is exported by several Shell extension handlers and namespace extensions to add commands to shortcut menus. When the user selects one of the commands that the handler or namespace extension added to a shortcut menu, the Shell calls its InvokeCommand method. The command can be specified by its menu identifier offset, defined when IContextMenu::QueryContextMenu was called, or by its associated verb. An application can invoke this method directly by obtaining a pointer to an object's IContextMenu interface. An application can also invoke this method indirectly by calling ShellExecute or ShellExecuteEx and specifying a verb that is supported by the namespace extension or handler.
If the verb, specified either by a canonical verb name or the command ID is not recognized by the context menu handler, it must return a failure (E_FAIL) to allow it to be passed on to the other context menu handlers that might implement that verb.
Although the pici parameter is declared in Shlobj.h as a CMINVOKECOMMANDINFO structure, in practice it often points to a CMINVOKECOMMANDINFOEX structure. This structure is an extended version of CMINVOKECOMMANDINFO and has several additional members that allow Unicode strings to be passed.
Note to Users
You can pass either structure to IContextMenu::InvokeCommand. Either will work for ANSI strings, but you must use a CMINVOKECOMMANDINFOEX structure for Unicode strings.
Note to Implementers
Check the cbSize member of pici to determine which structure was passed in. If it is a CMINVOKECOMMANDINFOEX structure and the fMask member has the CMIC_MASK_UNICODE flag set, you must cast pici to CMINVOKECOMMANDINFOEX to use the Unicode information contained in the last five members of the structure. |