/// <summary> /// Executes a command on the WebRowser object. /// </summary> /// <param name="command">A <see cref="WebBrowserCommands"/> value that specifies the command to execute.</param> /// <param name="options">A <see cref="WebBrowserCommandOptions"/> value that specifies the command options.</param> /// <param name="arguments">The command arguments.</param> /// <returns>The command output.</returns> public object ExecuteCommand(WebBrowserCommands command, WebBrowserCommandOptions options, object arguments) { try { this.CheckActiveXState(); object result = null; this.ActiveXWebBrowser.ExecWB(command, options, ref arguments, ref result); return(result); } catch { return(null); } }
public int Exec(IntPtr pguidCmdGroup, WebBrowserCommands nCmdID, WebBrowserCommandOptions nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { ////if (pguidCmdGroup is Guid) if (pguidCmdGroup != IntPtr.Zero) { Guid guidCmdGroup = (Guid)Marshal.PtrToStructure(pguidCmdGroup, typeof(Guid)); ////Guid guidCmdGroup = (Guid)pguidCmdGroup; if (guidCmdGroup == Interop.UnsafeNativeMethods.DocHostCommandHandlerCgid) { switch (nCmdID) { case WebBrowserCommands.ShowScriptError: var htmlDocument = (pvaIn != IntPtr.Zero) ? Marshal.GetObjectForNativeVariant(pvaIn) : null; var scriptErrorEventArgs = new WebBrowserScriptErrorEventArgs(htmlDocument); this.Host.OnScriptError(scriptErrorEventArgs); if (!scriptErrorEventArgs.Handled) { return(Interop.UnsafeNativeMethods.HRESULT.S_FALSE); } if (pvaOut != IntPtr.Zero) { Marshal.GetNativeVariantForObject(scriptErrorEventArgs.ContinueScripts, pvaOut); } return(Interop.UnsafeNativeMethods.HRESULT.S_OK); } return(Interop.NativeMethods.OLECMDERR.OLECMDERR_E_NOTSUPPORTED); } } return(Interop.NativeMethods.OLECMDERR.OLECMDERR_E_UNKNOWNGROUP); }
/// <summary> /// Queries the WebRowser object for the status of commands. /// </summary> /// <param name="command"> /// A <see cref="WebBrowserCommands"/> value that specifies the command to query. /// </param> /// <returns> /// A <see cref="WebBrowserCommandStatus"/> value with the status of the command. /// </returns> public WebBrowserCommandStatus GetCommandStatus(WebBrowserCommands command) { this.CheckActiveXState(); return(this.ActiveXWebBrowser.QueryStatusWB(command)); }
/// <summary> /// Executes a command on the WebRowser object. /// </summary> /// <param name="command">A <see cref="WebBrowserCommands"/> value that specifies the command to execute.</param> /// <param name="options">A <see cref="WebBrowserCommandOptions"/> value that specifies the command options.</param> /// <returns>The command output.</returns> public object ExecuteCommand(WebBrowserCommands command, WebBrowserCommandOptions options) { return(this.ExecuteCommand(command, options, null)); }
public int QueryStatus(IntPtr pguidCmdGroup, WebBrowserCommands cCmds, IntPtr prgCmds, IntPtr pCmdText) { return(UnsafeNativeMethods.HRESULT.S_OK); }