Click or drag to resize

ShellUtilitiesInvokeMenuItem Method (String, IntPtr, FuncShellMenuItem, Boolean, Boolean)

Invokes a shell item's context menu item.

Namespace:  ShellBoost.Core.Utilities
Assembly:  ShellBoost.Core (in ShellBoost.Core.dll) Version: 1.8.3.0
Syntax
C#
public static void InvokeMenuItem(
	string path,
	IntPtr hwnd,
	Func<ShellMenuItem, bool> predicate,
	bool throwOnError = true
)

Parameters

path
Type: SystemString
The shell item's path.
hwnd
Type: SystemIntPtr
A handle to the window that is the owner of the displayed UI. Callers must specify a legitimate value that can be used as the owner window for any UI that may be displayed. Failing to specify a value when calling from a UI thread (one with windows already created) will result in reentrancy and possible bugs.
predicate
Type: SystemFuncShellMenuItem, Boolean
The filter that determine wich item should be invoked in the list of available items.
throwOnError (Optional)
Type: SystemBoolean
true to throw error; otherwise false.
Exceptions
ExceptionCondition
ArgumentExceptionpath or predicate is null.
Remarks
This method behavior depends on many contextual parameters such as the process bitness (32 or 64 bit), the type of process (Console vs Windows), or the the current thread's COM apartment state (STA vs MTA, etc.). It also depends on how dynamic context menu handlers choose to add or not menu items.
See Also