IContextMenu::GetCommandString

Send Feedback

The GetCommandString method is called by the shell to validate that the command exists, to get the canonical command name, or to get the command help text.

Syntax

HRESULT GetCommandString(
  UINT idCmd,
  UINT uType,
  UINT * pwReserved,
  LPSTR pszName,
  UINT cchMax
);

Parameters

  • idCmd
    [in] Specifies the menu item ID, offset from the idCmdFirst parameter of QueryContextMenu.
  • uType
    [in] Bitmask that specifies that GetCommandString should either validate that the command exists, get the command name string, or get the help text string. For a list of possible flag values, see the table below.
  • pwReserved
    Reserved (ignored, must pass NULL).
  • pszName
    [in] Specifies the string buffer.
  • cchMax
    [in] Specifies the size of the string buffer.

Return Values

GetCommandString returns S_OK if it successfully validates that the command exists, if it successfully returns the command name, or if it successfully returns the command's help text string. GetCommandString returns an appropriate error code if it was unsuccessful.

Remarks

The command can be invoked programmatically if you pass the retrieved command name string to IContextMenu::InvokeCommand.

The following table lists the possible uFlags values.

Flag Value Description
GCS_VERB 0x00000000 Retrieve the command name specified as a canonical verb
GCS_HELPTEXT 0x00000001 Retrieve the help text for File Explorer's status bar
GCS_VALIDATE 0x00000002 Validate that the command exists

Requirements

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 | IContextMenu::InvokeCommand | IContextMenu::QueryContextMenu

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.