IWebBrowser2::ExecWB Method

Executes a command and returns the status of the command execution using the IOleCommandTarget interface.

Syntax

HRESULT ExecWB(
    OLECMDID cmdID,
    OLECMDEXECOPT cmdexecopt,
    VARIANT *pvaIn,
    VARIANT *pvaOut
);

Parameters

  • cmdID
    [in] An OLECMDID value that specifies the command to execute. For a discussion of command identifiers, see MSHTML Command Identifiers.
  • cmdexecopt
    [in] An OLECMDEXECOPT value that specifies the command options.
  • pvaIn
    [in] Pointer to a VARIANT structure that contains command input arguments. The type of this VARIANT structure depends on the type of the command identifier. This argument can be NULL.
  • pvaOut
    [in, out] A pointer to a VARIANT structure that receives and specifies command output. The type of this VARIANT structure depends on the type of the command identifier. This argument can be NULL.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

Certain commands (OLECMDID_CUT, OLECMDID_COPY, and OLECMDID_PASTE) are only available if URLACTION_SCRIPT_SAFE_ACTIVEX and URLACTION_SCRIPT_PASTE are set to URLPOLICY_ALLOW.

The WebBrowser object delegates this method to the top-level frame. If no frame exists, it returns E_FAIL.

See Also

IWebBrowser2::QueryStatusWB, OLECMDEXECOPT