Share via


IContextMenu::GetCommandString

4/8/2010

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 Value

GetCommandString returns S_OK if itsuccessfully 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

Header shlobj.h
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC 2000 and later

See Also

Reference

IContextMenu
IContextMenu::InvokeCommand
IContextMenu::QueryContextMenu