Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to programmatically launch WebView2's Find function. #1737

Open
RajeshAKumar opened this issue Sep 13, 2021 · 88 comments
Open

How to programmatically launch WebView2's Find function. #1737

RajeshAKumar opened this issue Sep 13, 2021 · 88 comments
Assignees
Labels
feature request feature request tracked We are tracking this work internally.

Comments

@RajeshAKumar
Copy link

RajeshAKumar commented Sep 13, 2021

We have a HTML page in local WPF app using WebView2, but want to highlight occurrences of a search phrase in the page.
WebView2 does a very nice job of showing this when invoked by user.
We want to leverage this function programmatically.

Can you please guide?

AB#36194641

@champnic
Copy link
Member

Hey @RajeshAKumar - I don't think we currently have a way to do this. Would you like me to add this as a scenario on our backlog?

@champnic champnic self-assigned this Sep 16, 2021
@Symbai
Copy link

Symbai commented Sep 16, 2021

want to highlight occurrences of a search phrase in the page.

This can be done via executing a javascript calling window.find() already. For more info see https://developer.mozilla.org/en-US/docs/Web/API/Window/find

@RajeshAKumar
Copy link
Author

want to highlight occurrences of a search phrase in the page.

This can be done via executing a javascript calling window.find() already. For more info see https://developer.mozilla.org/en-US/docs/Web/API/Window/find

Want to highlight "all" the words like how Edge/ Edge control does when we use CTRL + F.

@RajeshAKumar
Copy link
Author

Hey @RajeshAKumar - I don't think we currently have a way to do this. Would you like me to add this as a scenario on our backlog?

Yes please log this.
Also is there any way to make this work by "Sending CTRL + F" to the control?
I could not make that work either?

@champnic champnic added feature request feature request tracked We are tracking this work internally. and removed question labels Sep 16, 2021
@champnic
Copy link
Member

@RajeshAKumar I've added this as a scenario on our backlog - thanks!

@RajeshAKumar
Copy link
Author

want to highlight occurrences of a search phrase in the page.

This can be done via executing a javascript calling window.find() already. For more info see https://developer.mozilla.org/en-US/docs/Web/API/Window/find

I tried that and it highlights one time, once we click the page, the highlight goes away.
We want to replicate the Edge control CTRL + F behavior or something close where all matches are shown and scrollbar is marked to indicate where they are in page.

@ajtruckle
Copy link

Proper support for this would be great please.

@ajtruckle
Copy link

ajtruckle commented Feb 5, 2022

@RajeshAKumar you said:

WebView2 does a very nice job of showing this when invoked by user.

How can I do this with WebView2? I know how to invoke Find / Find Next in CHtmlView using an ExecWB call. It displays its own window with Find / Find Next capabilities etc. But WebView2?

MNU_MWBEditor_Edit_Find

@RajeshAKumar
Copy link
Author

@RajeshAKumar you said:

WebView2 does a very nice job of showing this when invoked by user.
How can I do this with WebView2? I know how to invoke Find / Find Next in CHtmlView using an ExecWB call. It displays its own window with Find / Find Next capabilities etc. But WebView2?

MNU_MWBEditor_Edit_Find

Can you explain this via APIs to understand how to use this?
I would want the window to go away with options selected and window with matching text highlighted.

@ajtruckle
Copy link

@RajeshAKumar ? My screen shot is of CHtmlView which is unrelated to WebView2.

@RajeshAKumar
Copy link
Author

My issue is to solve this via API in WebView2 in WPF.

@ajtruckle
Copy link

I guess I miss-read your original text.

@frankdekker
Copy link

My issue is to solve this via API in WebView2 in WPF.

I'm also looking for an API to search on the page. The current Microsoft Edge native find dialog steals focus from the main window and when pressing escape doesn't give it back. Kinda breaking the user experience when do quick searches.

The API from CefSharp worked quite well:

// start a find
WebView2.Find(string int identifier, string searchText, bool forward, bool matchCase, bool findNext)
// callback for each time the find reports back
WebView2.FindResultCallback += (int identifier, int count, Rect selectionRect, int activeMatchOrdinal, bool finalUpdate) => {}
// stop the search
WebView2.StopFinding(bool clearSelection)

To be able to build a UI that fits more with the application WebView2 is integrated with:
image
image

@ajtruckle
Copy link

FYI, I did just try adding this to a custom context menu:

wil::com_ptr<ICoreWebView2ContextMenuItem> itemFind;
CHECK_FAILURE(webviewEnvironment->CreateContextMenuItem(
	L"Find", nullptr,
	COREWEBVIEW2_CONTEXT_MENU_ITEM_KIND_COMMAND, &itemFind));

CHECK_FAILURE(itemFind->add_CustomItemSelected(
	Callback<ICoreWebView2CustomItemSelectedEventHandler>(
		[appWindow = this, target](ICoreWebView2ContextMenuItem* sender, IUnknown* args)
		{
			appWindow->m_pImpl->m_webView->ExecuteScript(L"window.find()", nullptr);

			return S_OK;
		})
	.Get(), nullptr));
CHECK_FAILURE(items->InsertValueAtIndex(itemsCount, itemFind.get()));
itemsCount++;

It doesn't work. Nothing shows on screen. When I used the CHtmlView control this was a simple task:

m_pHtmlPreview->ExecWB(OLECMDID_FIND, OLECMDEXECOPT_PROMPTUSER, nullptr, nullptr);

Is there any updates on this issue? Thank you.

@ajtruckle
Copy link

Hi @champnic !

I have now managed to use SendInput to invoke the Find window via my context menu:

// ===============================================================
wil::com_ptr<ICoreWebView2ContextMenuItem> itemFind;
CHECK_FAILURE(webviewEnvironment->CreateContextMenuItem(
	L"Find (CTRL + F)", nullptr,
	COREWEBVIEW2_CONTEXT_MENU_ITEM_KIND_COMMAND, &itemFind));

CHECK_FAILURE(itemFind->add_CustomItemSelected(
	Callback<ICoreWebView2CustomItemSelectedEventHandler>(
		[](ICoreWebView2ContextMenuItem* sender, IUnknown* args)
		{
			// Create an array of generic keyboard INPUT structures
			std::vector<INPUT> vIP(4);
			for (int n = 0; n < 4; ++n)
			{
				vIP.at(n).type = INPUT_KEYBOARD;
				vIP.at(n).ki.wScan = 0;
				vIP.at(n).ki.time = 0;
				vIP.at(n).ki.dwFlags = 0; // 0 for key press
				vIP.at(n).ki.dwExtraInfo = 0;
			}

			vIP.at(0).ki.wVk = VK_CONTROL;
			vIP.at(1).ki.wVk = 'F';

			vIP.at(2).ki.wVk = 'F';
			vIP.at(2).ki.dwFlags = KEYEVENTF_KEYUP;

			vIP.at(3).ki.wVk = VK_CONTROL;
			vIP.at(3).ki.dwFlags = KEYEVENTF_KEYUP;

			SendInput(4, vIP.data(), sizeof(INPUT));

			return S_OK;
		})
	.Get(), nullptr));

CHECK_FAILURE(items->InsertValueAtIndex(itemsCount, itemFind.get()));
itemsCount++;
// ===============================================================

This works fine:

ContextMenuFind

My only request is that the Search bar be improved. The CHtmlView counterpart is richer:

image

@wusyong
Copy link

wusyong commented May 24, 2022

FWIW, electron also has this kind of feature

@michaldivis
Copy link

I'd love to have this feature as well.

@CiccioIV
Copy link

CiccioIV commented Aug 6, 2022

As a workaround, I did it by using the Winform SendKeys class .
You can use it in wpf apps too, by adding true in the project properties

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWPF>true</UseWPF>
    <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>

then, in my click method, I've first passed the focus to the webview2 (browser) element.
Then, called the SendWait method with "{F3}" as parameter

        private void openSearch(object sender, RoutedEventArgs e)
        {
            this.browser.Focus();
            System.Windows.Forms.SendKeys.SendWait("{F3}");
        }

not the most elegant way, perhaps. But it works.

@jebihug
Copy link

jebihug commented Aug 16, 2022

Can't find a way to close the find UI programmatically.

@champnic
Copy link
Member

@jebihug You could probably send an Escape key to dismiss the UI.

@jebihug
Copy link

jebihug commented Aug 17, 2022

@champnic This is not working. Especially when the browser don't have the focus and when there is many browsers opened and I want to close the find UI of one of them.

@victorhuangwq
Copy link
Collaborator

victorhuangwq commented May 7, 2024

As you can see, it's still in the works. I'm unable to promise you a timeline.
But either @maxwellmyers or I will keep you (and this thread) posted whenever we have any updates.

@ThHeidenreich
Copy link

@victorhuangwq Any new info about the api release? We are now on the end of august... Would be very nice to have...

@ajtruckle
Copy link

ajtruckle commented Aug 26, 2024 via email

@zooguest
Copy link

We have a HTML page in local WPF app using WebView2, but want to highlight occurrences of a search phrase in the page. WebView2 does a very nice job of showing this when invoked by user. We want to leverage this function programmatically.

Can you please guide?

AB#36194641

Ohhhh. Today is the anniversary of this question. 3 years. Almost done man ;)

@ajtruckle
Copy link

@zoobesucher Oh yes! 3 years. Wow!

@nirdil
Copy link

nirdil commented Oct 11, 2024

@champnic any updates on this?
It's a crucial functionality and there's no known workarounds for this.

@ajtruckle
Copy link

@nirdil @champnic
A long time ago there were lots of tweaks to the documentation. Then nothing. So I have no idea I am afraid.

@Optimierungswerfer
Copy link

Ever since the mass layoffs and subsequent AI hype, I feel like there have not been many resources left dedicated to projects like WebView2 by Microsoft. I just wish they would handle it as free and open source software, so that the people who need this functionality implemented could at least do something about it themselves. I faintly remember the WebView2 team stating intentions to open source it a few years ago.

@nirdil
Copy link

nirdil commented Oct 14, 2024

Would have been great if it was open source and maintained by the community.
@champnic any way to make that happen?

@ajtruckle
Copy link

ajtruckle commented Oct 14, 2024 via email

@champnic
Copy link
Member

champnic commented Oct 16, 2024

Hey all - This is still being worked on. It ran into some issues during implementation that we have mostly solved at this point. Right now the estimate is that this will be available as a stable API with the version 132 release SDK, which should ship around mid-January.

@micilini
Copy link

micilini commented Jan 2, 2025

I have a solution my friends!!!

I have an application made with C# and WPF, with WebView2 and like to open Find Dialog when user click on my button (Open Find Dialog programatically).

For this, I need to download this package:

Install-Package InputSimulator

And this is my method:

using WindowsInput;

private void OpenSearchBox()
{
    myWebView.Focus();//This will focus WebView

    //This will simulate CTRL + F:
    var sim = new InputSimulator();
    sim.Keyboard.ModifiedKeyStroke(WindowsInput.Native.VirtualKeyCode.CONTROL, WindowsInput.Native.VirtualKeyCode.VK_F);
}

If you are using WindowsForms, try using SendKeys:

using System.Windows.Forms;

private void SimulateCtrlF()
{
    myWebView.Focus();//This will focus WebView
    SendKeys.Send("^(f)"); //This will simulate CTRL + F:
}

Works like a charm!

@maxwellmyers
Copy link

Hi all!

The FindOnPage API is now available as an experimental API in 1.0.3079-prerelease.

Using this API, your app can programmatically control Find operations, enabling you to:

  • Customize Find options (Find Term, Case Sensitivity, Word Matching, Match Highlighting, Default UI Suppression).
  • Find text strings and navigate among them within a WebView2 control.
  • Programmatically initiate Find operations and navigate Find results.
  • Track the status of Find operations (completion of find operations, events for match count and match index changing).

Please give it a try and let us know if you have any feedback!

@ajtruckle
Copy link

@maxwellmyers
Thanks. So I change to prerelease nuget package. But I can use stable edge? Only want to change what I have to. Thanks for confirming.

@victorhuangwq
Copy link
Collaborator

It's currently only in prerelease SDK, so you would need to use Edge Canary to test the feature.

@victorhuangwq
Copy link
Collaborator

cc @pushkin-

@ajtruckle
Copy link

@victorhuangwq
Downloaded Canary. About to download prerelease.

But whilst the announcement mentions the APIs I can't see the code snippets. Eg: How to invoke the find windo with specified options.

@ajtruckle
Copy link

ajtruckle commented Jan 24, 2025

Struggling.

  1. Downloaded Edge Canary
  2. Upgraded to prerelease nuget
  3. Trying to block/copy from the samples in the API docs. Eg:
wil::com_ptr<ICoreWebView2FindOptions> CWebBrowser::InitializeFindOptions(const std::wstring& findTerm)
{
	auto webView2Environment18 = m_pImpl->m_webViewEnvironment.try_query<ICoreWebView2Environment18>();
	CHECK_FEATURE_RETURN(webView2Environment18);

	// Initialize Find options
	wil::com_ptr<ICoreWebView2FindOptions> find_options;
	CHECK_FAILURE(webView2Environment18->CreateFindOptions(&find_options));
	CHECK_FAILURE(find_options->put_FindTerm(findTerm.c_str()));

	return find_options;
}

bool CWebBrowser::ConfigureAndExecuteFind(const std::wstring& findTerm)
{
	auto find_options = InitializeFindOptions(findTerm);
	if (!find_options)
	{
		return false;
	}

	auto webView2Environment29 = m_pImpl->m_webViewEnvironment.try_query<ICoreWebView2Environment29>();
	CHECK_FEATURE_RETURN(webView2Environment29);

	// Get the Find interface.
	wil::com_ptr<ICoreWebView2Find> webView2Find;
	CHECK_FAILURE(webView2Environment29->get_Find(&webView2Find));

	// By default Find will use the default UI and highlight all matches. If you want different behavior
	// you can change the SuppressDefaultDialog and ShouldHighlightAllMatches properties here.

	// Start the Find operation with a callback for completion.
	CHECK_FAILURE(webView2Find->StartFind(
		find_options.get(),
		Callback<ICoreWebView2FindOperationCompletedHandler>(
			[this](HRESULT result, BOOL status) -> HRESULT
			{
				if (SUCCEEDED(result))
				{
					// Optionally update UI elements here upon successful Find operation.
				}
				else
				{
					// Handle errors.
				}
				return S_OK;
			}).Get()));

	// End user interaction is handled via UI.
	return true;
}

These are unknown, why?

  • ICoreWebView2FindOptions
  • ICoreWebView2Environment18
  • CHECK_FEATURE_RETURN
  • ICoreWebView2Environment29
  • ICoreWebView2Find

What step am I missing?

I guess I need to change the path to Edge to:

C:\Users\xxx\AppData\Local\Microsoft\Edge SxS\Application.

As you can see, I never use pre-release. So lost!

@pushkin-
Copy link

@victorhuangwq just starting looking. FYI, this doc should be updated to say FindNext in the sentence:

If called when there is no find session active, FindPrevious will silently fail.

@pushkin-
Copy link

Possibly relates to @ajtruckle 's comment above, but I copy this statement from the example:

	var find_options = new CoreWebView2FindOptions
	{
		FindTerm = findTerm
	};

This gives me the error:

Image

Not sure what I'm supposed to do here.

@ajtruckle not following what the issue is for you. If you can compile but running fails, you might just need to point your app to use the Canary WebView2 by following steps here. So either add a regkey or initialize your webview2 with CoreWebView2EnvironmentOptions.ChannelSearchKind

If compiling doesn't even work, then not sure. Maybe relates to my issue.

@ajtruckle
Copy link

ajtruckle commented Jan 24, 2025 via email

@pushkin-
Copy link

@ajtruckle for me, the interfaces become known when updating my nuget package. If that didn't help, then I'm not sure. I'm using Visual Studio -> Nuget package manager -> update, and it worked fine

@ajtruckle
Copy link

ajtruckle commented Jan 24, 2025 via email

@ajtruckle
Copy link

I found the definition for CHECK_FEATURE_RETURN:

#define CHECK_FEATURE_RETURN(feature) { if (!feature) { FeatureNotAvailable(); return true; } }

@ajtruckle
Copy link

Still messed up:

Image

Image

Why are the new Find classes not showing?

@ajtruckle
Copy link

OK, this is all very messy! For starters I had to examine the header files created by the pre-release. And the classes are different:

  • ICoreWebView2ExperimentalFindOptions
  • ICoreWebView2ExperimentalEnvironment18

So this works:

wil::com_ptr<ICoreWebView2ExperimentalFindOptions> CWebBrowser::InitializeFindOptions(const std::wstring& findTerm)
{
	// Query for the ICoreWebView2Environment18 interface.
	auto webView2Environment18 = m_pImpl->m_webViewEnvironment.try_query<ICoreWebView2ExperimentalEnvironment18>();
	CHECK_FEATURE_RETURN(webView2Environment18);

	// Initialize Find options
	wil::com_ptr<ICoreWebView2ExperimentalFindOptions> find_options;
	CHECK_FAILURE(webView2Environment18->CreateFindOptions(&find_options));
	CHECK_FAILURE(find_options->put_FindTerm(findTerm.c_str()));

	return find_options;
}

But the CHECK_FEATURE_RETURN is flagging in the IDE:

Image

And for the other function, I need to use:

  • ICoreWebView2Experimental29
  • ICoreWebView2ExperimentalFind
  • Start (not StartFind)

But, I can't find an equivalent to ICoreWebView2FindOperationCompletedHandler. Only: ICoreWebView2ExperimentalFindStartCompletedHandler.

Whilst compiling, the first macro I referred to bombs out:

6>  D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\EdgeWebBrowser.cpp(2070,2): error C2440: 'return': cannot convert from 'bool' to 'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>'
6>  (compiling source file '/EdgeWebBrowser.cpp')
6>      D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\EdgeWebBrowser.cpp(2070,2):
6>      'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t': no overloaded function could convert all the argument types
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(227,5):
6>          could be 'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(ICoreWebView2ExperimentalFindOptions *) noexcept'
6>              D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\EdgeWebBrowser.cpp(2070,2):
6>              'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(ICoreWebView2ExperimentalFindOptions *) noexcept': cannot convert argument 1 from 'bool' to 'ICoreWebView2ExperimentalFindOptions *'
6>                  D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\EdgeWebBrowser.cpp(2070,2):
6>                  Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or parenthesized function-style cast
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(222,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(wistd::nullptr_t) noexcept'
6>              D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\EdgeWebBrowser.cpp(2070,2):
6>              'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(wistd::nullptr_t) noexcept': cannot convert argument 1 from 'bool' to 'wistd::nullptr_t'
6>                  D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\EdgeWebBrowser.cpp(2070,2):
6>                  only a null pointer constant can be converted to nullptr_t
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(909,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(U *,wil::details::tag_try_com_copy) noexcept'
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(900,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(U *,wil::details::tag_com_copy)'
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(894,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(U *,wil::details::tag_try_com_query) noexcept'
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(888,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(U *,wil::details::tag_com_query)'
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(850,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(Microsoft::WRL::ComPtr<U> &&) noexcept'
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(844,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(const Microsoft::WRL::ComPtr<U> &) noexcept'
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(253,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(wil::com_ptr_t<U,err> &&) noexcept'
6>          D:\My Programs\2022\MeetSchedAssist\packages\Microsoft.Windows.ImplementationLibrary.1.0.240803.1\include\wil\com.h(242,5):
6>          or       'wil::com_ptr_t<ICoreWebView2ExperimentalFindOptions,wil::err_exception_policy>::com_ptr_t(const wil::com_ptr_t<U,err> &) noexcept'
6>          D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\EdgeWebBrowser.cpp(2070,2):
6>          while trying to match the argument list '(bool)'

So I commented that line out for now. But compiling still fails with the completion lambda:

6>  EdgeWebBrowser.cpp
6>  C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\event.h(354,60): error C2064: term does not evaluate to a function taking 1 arguments
6>  (compiling source file '/EdgeWebBrowser.cpp')
6>      C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\event.h(354,60):
6>      class does not define an 'operator()' or a user defined conversion operator to a pointer-to-function or reference-to-function that takes appropriate number of arguments
6>      C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\event.h(354,60):
6>      while trying to match the argument list '(T)'
6>          with
6>          [
6>              T=HRESULT
6>          ]
6>      C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\event.h(354,60):
6>      the template instantiation context (the oldest one first) is
6>          D:\My Programs\2022\MeetSchedAssist\Meeting Schedule Assistant\EdgeWebBrowser.cpp(2101,3):
6>          see reference to function template instantiation 'Microsoft::WRL::ComPtr<TDelegateInterface> Microsoft::WRL::Callback<ICoreWebView2ExperimentalFindStartCompletedHandler,CWebBrowser::ConfigureAndExecuteFind::<lambda_3>>(TLambda &&) noexcept' being compiled
6>          with
6>          [
6>              TDelegateInterface=ICoreWebView2ExperimentalFindStartCompletedHandler,
6>              TLambda=CWebBrowser::ConfigureAndExecuteFind::<lambda_3>
6>          ]
6>          C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\event.h(460,45):
6>          see reference to function template instantiation 'Microsoft::WRL::ComPtr<TDelegateInterface> Microsoft::WRL::Details::DelegateArgTraits<HRESULT (__cdecl ICoreWebView2ExperimentalFindStartCompletedHandler::* )(HRESULT)>::Callback<ICoreWebView2ExperimentalFindStartCompletedHandler,ICoreWebView2ExperimentalFindStartCompletedHandler,Microsoft::WRL::NoCheck,T>(TLambda &&) noexcept' being compiled
6>          with
6>          [
6>              TDelegateInterface=ICoreWebView2ExperimentalFindStartCompletedHandler,
6>              T=CWebBrowser::ConfigureAndExecuteFind::<lambda_3>,
6>              TLambda=CWebBrowser::ConfigureAndExecuteFind::<lambda_3>
6>          ]
6>          C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\event.h(367,9):
6>          while compiling class template member function 'Microsoft::WRL::ComPtr<TDelegateInterface>::ComPtr(Microsoft::WRL::ComPtr<U> &&,Details::EnableIf<Microsoft::WRL::Details::IsConvertible<U*,T*>::value,void*>::type *) noexcept'
6>          with
6>          [
6>              TDelegateInterface=ICoreWebView2ExperimentalFindStartCompletedHandler,
6>              T=ICoreWebView2ExperimentalFindStartCompletedHandler
6>          ]
6>          C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\event.h(367,9):
6>          see reference to class template instantiation 'Microsoft::WRL::Details::IsConvertible<Microsoft::WRL::Details::DelegateArgTraits<HRESULT (__cdecl ICoreWebView2ExperimentalFindStartCompletedHandler::* )(HRESULT)>::DelegateInvokeHelper<ICoreWebView2ExperimentalFindStartCompletedHandler,T,Microsoft::WRL::NoCheck,HRESULT> *,ICoreWebView2ExperimentalFindStartCompletedHandler *>' being compiled
6>          with
6>          [
6>              T=CWebBrowser::ConfigureAndExecuteFind::<lambda_3>
6>          ]
6>          C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\internal.h(67,35):
6>          see reference to class template instantiation 'Microsoft::WRL::Details::DelegateArgTraits<HRESULT (__cdecl ICoreWebView2ExperimentalFindStartCompletedHandler::* )(HRESULT)>::DelegateInvokeHelper<ICoreWebView2ExperimentalFindStartCompletedHandler,T,Microsoft::WRL::NoCheck,HRESULT>' being compiled
6>          with
6>          [
6>              T=CWebBrowser::ConfigureAndExecuteFind::<lambda_3>
6>          ]
6>          C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt\wrl\event.h(352,35):
6>          while compiling class template member function 'HRESULT Microsoft::WRL::Details::DelegateArgTraits<HRESULT (__cdecl ICoreWebView2ExperimentalFindStartCompletedHandler::* )(HRESULT)>::DelegateInvokeHelper<ICoreWebView2ExperimentalFindStartCompletedHandler,T,Microsoft::WRL::NoCheck,HRESULT>::Invoke(HRESULT) noexcept'
6>          with
6>          [
6>              T=CWebBrowser::ConfigureAndExecuteFind::<lambda_3>
6>          ]

@ajtruckle
Copy link

@pushkin- I think I do have same compile error

class does not define an operator() or a user defined conversion operator to a pointer-to-function or reference-to-function that takes appropriate number of arguments

@ajtruckle
Copy link

CHECK_FEATURE_RETURN returns true. Yet the function we call it in returns a find options object. Hence we can't use that macro in this context. Not sure how that would work in official sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests