interface ICoreWebView2ExperimentalDevToolsProtocolEventReceivedEventArgs

Note

This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.

Note

This an experimental API that is shipped with our prerelease SDK. See WebView2 release notes.

interface ICoreWebView2ExperimentalDevToolsProtocolEventReceivedEventArgs
  : public ICoreWebView2DevToolsProtocolEventReceivedEventArgs

Event args for the DevToolsProtocolEventReceived event that provides the session ID of the target where the event originates from.

Summary

Members Descriptions
get_SessionId The sessionId of the target where the event originates from.

Applies to

Product Introduced
WebView2 Win32 N/A
WebView2 Win32 Prerelease 1.0.1158

Members

get_SessionId

The sessionId of the target where the event originates from.

public HRESULT get_SessionId(LPWSTR * sessionId)

Empty string is returned as sessionId if the event comes from the default session for the top page.

                    wil::com_ptr<
                        ICoreWebView2ExperimentalDevToolsProtocolEventReceivedEventArgs>
                        args2;
                    if (SUCCEEDED(args->QueryInterface(IID_PPV_ARGS(&args2))))
                    {
                        wil::unique_cotaskmem_string sessionId;
                        CHECK_FAILURE(args2->get_SessionId(&sessionId));
                        if (sessionId.get() && *sessionId.get())
                        {
                            title = eventName + L" (session:" + sessionId.get() + L")";
                            std::wstring targetId = m_devToolsSessionMap[sessionId.get()];
                            std::wstring targetLabel = m_devToolsTargetLabelMap[targetId];
                            details = L"From " + targetLabel + L" (session:" + sessionId.get() +
                                      L")\r\n" + details;
                        }
                    }