Skip to content

Latest commit

 

History

History
69 lines (53 loc) · 2.96 KB

icorewebview2devtoolsprotocoleventreceivedeventargs2.md

File metadata and controls

69 lines (53 loc) · 2.96 KB
description title ms.date keywords topic_type api_name api_type api_location
This is a continuation of the ICoreWebView2DevToolsProtocolEventReceivedEventArgs interface that provides the session ID of the target where the event originates from.
WebView2 Win32 C++ ICoreWebView2DevToolsProtocolEventReceivedEventArgs2
05/20/2024
IWebView2, IWebView2WebView, webview2, webview, win32 apps, win32, edge, ICoreWebView2, ICoreWebView2Controller, browser control, edge html, ICoreWebView2DevToolsProtocolEventReceivedEventArgs2
APIRef
ICoreWebView2DevToolsProtocolEventReceivedEventArgs2
ICoreWebView2DevToolsProtocolEventReceivedEventArgs2.get_SessionId
COM
embeddedbrowserwebview.dll

interface ICoreWebView2DevToolsProtocolEventReceivedEventArgs2

[!INCLUDE deprecation-note]

interface ICoreWebView2DevToolsProtocolEventReceivedEventArgs2
  : public ICoreWebView2DevToolsProtocolEventReceivedEventArgs

This is a continuation of the ICoreWebView2DevToolsProtocolEventReceivedEventArgs interface 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 1.0.1185.39
WebView2 Win32 Prerelease 1.0.1189

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.

The caller must free the returned string with CoTaskMemFree. See API Conventions.

                    wil::com_ptr<ICoreWebView2DevToolsProtocolEventReceivedEventArgs2> 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;
                        }
                    }