SHInvokeCommandsOnContextMenuEx

Go to Home Page

Invokes a collection of verbs on a context menu

Syntax

HRESULT WINAPI SHInvokeCommandsOnContextMenuEx (
    HWND hwnd,
    IObjectWithSite* pSite,
    IContextMenu* pCtxMenu,
    DWORD fMask,
    UINT queryFlags,
    LPCSTR* ppszVerbs,
    UINT numVerbs,
    LPCWSTR pwszDirectory
)

Parameters

hwnd
The owner window for any UI
pSite
A site to host the context menu, can be NULL.
pCtxMenu
A context menu interface to manipulate
fMask
A collection of CMIC_ flags to pass onto the CMINVOKECOMANDINFO structure used with pCtxMenu->InvokeCommand()
queryFlags
A collection of CMF_ flags to pass as the uFlags parameter of pCtxMenu->QueryContextMenu()
ppszVerbs
A string array of verbs to invoke on the context menu. Can be NULL.
numVerbs
Number of elements in the ppwszVerbs array. Cannot be more than 1
pwszDirectory
A path to use as the lpDirectoryW member of the CMINVOKECOMMANDINFOEX structure passed to pCtxMenu->InvokeCommand(). Can be NULL.

Return Value

S_OK on success, standard COM error code on failure

Remarks

If any of pwszDirectory, ppszVerbs, or *ppszVerbs have a value, CMIC_MASK_UNICODE is forced on to the fMask parameter. If neither have a value, fMask is ignored.

If either ppszVerbs or *ppszVerbs are NULL, CMF_DEFAULTONLY is forced on to the queryFlags parameter. If both are not NULL, but the function fails to allocate memory for a copy of *ppszVerbs, CMF_OPTIMIZEFORINVOKE is forced on.

This function is also known as _SHInvokeCommandsOnContextMenuEx@32.