MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / FileComponent

Method FileComponent

SampleApps/WebView2APISample/FileComponent.cpp:15–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace Microsoft::WRL;
14
15FileComponent::FileComponent(AppWindow* appWindow)
16 : m_appWindow(appWindow), m_webView(appWindow->GetWebView())
17{
18 //! [DocumentTitleChanged]
19 // Register a handler for the DocumentTitleChanged event.
20 // This handler just announces the new title on the window's title bar.
21 CHECK_FAILURE(m_webView->add_DocumentTitleChanged(
22 Callback<ICoreWebView2DocumentTitleChangedEventHandler>(
23 [this](ICoreWebView2* sender, IUnknown* args) -> HRESULT {
24 wil::unique_cotaskmem_string title;
25 CHECK_FAILURE(sender->get_DocumentTitle(&title));
26 m_appWindow->SetDocumentTitle(title.get());
27 return S_OK;
28 })
29 .Get(),
30 &m_documentTitleChangedToken));
31 //! [DocumentTitleChanged]
32}
33
34bool FileComponent::HandleWindowMessage(
35 HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* result)

Callers

nothing calls this directly

Calls 2

SetDocumentTitleMethod · 0.80
GetWebViewMethod · 0.45

Tested by

no test coverage detected