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

Method ShouldMatchWord

SampleApps/WebView2APISample/AppWindow.cpp:1591–1614  ·  view source on GitHub ↗

[ShouldMatchWord]

Source from the content-addressed store, hash-verified

1589
1590//! [ShouldMatchWord]
1591bool AppWindow::ShouldMatchWord()
1592{
1593 auto webView2_28 = m_webView.try_query<ICoreWebView2_28>();
1594 CHECK_FEATURE_RETURN(webView2_28);
1595 wil::com_ptr<ICoreWebView2Find> webView2find;
1596 CHECK_FAILURE(webView2_28->get_Find(&webView2find));
1597
1598 auto m_env15 = m_webViewEnvironment.try_query<ICoreWebView2Environment15>();
1599 CHECK_FEATURE_RETURN(m_env15);
1600 CHECK_FAILURE(webView2find->Stop());
1601
1602 if (!findOptions)
1603 {
1604 findOptions = SetDefaultFindOptions();
1605 }
1606 BOOL shouldMatchWord;
1607 findOptions->get_ShouldMatchWord(&shouldMatchWord);
1608 CHECK_FAILURE(findOptions->put_ShouldMatchWord(!shouldMatchWord));
1609 CHECK_FAILURE(webView2find->Start(
1610 findOptions.get(), Callback<ICoreWebView2FindStartCompletedHandler>(
1611 [this](HRESULT result) -> HRESULT { return S_OK; })
1612 .Get()));
1613 return true;
1614}
1615//! [ShouldMatchWord]
1616
1617//! [SuppressDefaultFindDialog]

Callers

nothing calls this directly

Calls 1

StartMethod · 0.45

Tested by

no test coverage detected