IHandlerActivationHost::BeforeCoCreateInstance method (shobjidl_core.h)

Notifies a client of ShellExecuteEx that a handler is about to be created, giving that client the opportunity to display UI confirming the use of that handler or reject it by returning a specific error code.


HRESULT BeforeCoCreateInstance(
  [in] REFCLSID        clsidHandler,
  [in] IShellItemArray *itemsBeingActivated,
  [in] IHandlerInfo    *handlerInfo


[in] clsidHandler

Identifies the handler.

[in] itemsBeingActivated

The Shell item objects that will be passed to the handler. Typically there is only one, but in some cases there can be more than one.

[in] handlerInfo

Provides access to information about the handler that will be invoked. This object also supports IHandlerInfo2 on versions of Windows that support that interface.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code, HRESULT_FROM_WIN32(ERROR_CANCELLED) indicates that the ShellExecute call should be canceled, EXECUTE_E_LAUNCH_APPLICATION indicates that this handler should not be used, but if there is another it should be used.


Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)

See also