Send Feedback

The InvokeCommand method executes the context menu command when the user selects a menu item that was added with the IContextMenu::QueryContextMenu method.


HRESULT InvokeCommand (


  • lpici
    Reference to the command information structure CMINVOKECOMMANDINFO. This is a data structure used to store the command, along with information about the command, such as its working directory and any optional parameters. For a list of the structure's members, see the table below*.*

Return Values

InvokeCommand returns S_OK if the command was successfully invoked or an appropriate error message if it was not.


When InvokeCommand is called by the user, lpVerb's LOWORD contains the menu item ID offset idCmdFirst. InvokeCommand can also be called programmatically. In this case, lpVerb specifies the canonical name of the command to be invoked, which is typically retrieved with the IContextMenu::GetCommandString method.


Pocket PC: Pocket PC 2000 and later.
Smartphone: none
OS Versions: Windows CE 3.0 and later.
Header: Declared in shlobj.h.

See Also

IContextMenu | CMINVOKECOMMANDINFO | IContextMenu::GetCommandString | IContextMenu::QueryContextMenu

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.