Help Center

CWebView2.CallDevToolsProtocolMethodmethod

Runs an asynchronous **DevToolsProtocol** method.

WebViewmethoddocumented

Syntax

FUNCTION CallDevToolsProtocolMethod (BYVAL methodName AS LPCWSTR, BYVAL parametersAsJson AS LPCWSTR, BYVAL handler AS Afx_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler PTR) AS HRESULT

Parameters

NameDescription
methodName[in] Full name of the method in the {domain}.{method} format.
parametersAsJson[in] A JSON formatted string containing the parameters for the corresponding method.
handler[in] A pointer to the implemented Afx_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler callback interface.

Description

Runs an asynchronous DevToolsProtocol method.

For more information about available methods, navigate to DevTools Protocol Viewer. The methodName parameter is the full name of the method in the {domain}.{method} format. The arametersAsJson parameter is a JSON formatted string containing the parameters for the corresponding method. The Invoke method of the handler is run when the method asynchronously completes. Invoke is run with the return object of the method as a JSON string. This function returns E_INVALIDARG if the methodName is unknown or the parametersAsJson has an error. In the case of such an error, the returnObjectAsJson parameter of the handler will include information about the error. Note even though WebView2 dispatches the CDP messages in the order called, CDP method calls may be processed out of order. If you require CDP methods to run in a particular order, you should wait for the previous method's completed handler to run before calling the next method. If the method is to run in AddNewWindowRequested handler it should be called before the new window is set if the cdp message should affect the initial navigation. If called after setting the NewWindow property, the cdp messages may or may not apply to the initial navigation and may only apply to the subsequent navigation. For more details see ICoreWebView2NewWindowRequestedEventArgs.put_NewWindow.

Reference

  • Defined in AfxNova/CWebView2.inc:789
  • Documented in WebView/CWebWiew2 Class.md
  • Topic: CWebView2 Class