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

Can WebView2 be used inside a Dll? #3240

Closed
mark-in-tex opened this issue Feb 25, 2023 · 10 comments
Closed

Can WebView2 be used inside a Dll? #3240

mark-in-tex opened this issue Feb 25, 2023 · 10 comments
Assignees

Comments

@mark-in-tex
Copy link

Tested the WebView2GettingStarted project. Worked fine. Created a MFC Dll and copied the HelloWebView.cpp file and added it to the Dll project. Renamed WinMain to something else. Installed the packages from NuGet.

When the Dll is compiled, I get the error:

Error C2440 'specialization': cannot convert from 'void (__stdcall *)(HANDLE) noexcept' to 'unknown-type' WebView2Dll c:\temp\webview2dll\packages\microsoft.windows.implementationlibrary.1.0.230202.1\include\wil\resource.h 2550

Any suggestions on an option setting or something else to fix the problem?

I modified WINAPI_FAMILY to WINAPI_PARTITION_DESKTOP and got rid of that problem but other parameters (e.g. IDCompositionDevice)were not being defined.

@novac42
Copy link
Contributor

novac42 commented Feb 27, 2023

Thanks for reaching out. I've assigned this to a dev that can best answer your question.

@LiangTheDev
Copy link
Member

If you include <dcomp.h>, IDCompositionDevice should be defined. HelloWebView.cpp does not use IDCompositionDevice. Which file that has IDCompositionDevice and failed to build?

@mark-in-tex
Copy link
Author

mark-in-tex commented Feb 27, 2023 via email

@LiangTheDev
Copy link
Member

Is this the same issue as #1840?

@LiangTheDev
Copy link
Member

There is also similar feedback in MicrosoftEdge/WebView2Samples#108.

@mark-in-tex
Copy link
Author

mark-in-tex commented Feb 28, 2023 via email

@icnocop
Copy link

icnocop commented Mar 24, 2023

Error C2440 'specialization': cannot convert from 'void (__stdcall *)(HANDLE) noexcept' to 'unknown-type' WebView2Dll c:\temp\webview2dll\packages\microsoft.windows.implementationlibrary.1.0.230202.1\include\wil\resource.h 2550

See microsoft/wil#25 and microsoft/wil#272 and microsoft/wil#302

@icnocop
Copy link

icnocop commented Mar 24, 2023

As a work-around, downgrade the NuGet package Microsoft.Windows.ImplementationLibrary to 1.0.210803.1.

@mark-in-tex
Copy link
Author

mark-in-tex commented Mar 24, 2023 via email

@xiaoyaocode163
Copy link

WebView2Loader.dll for vba,VB6 need ADD some Export API · Issue #3536 · MicrosoftEdge/WebView2Feedback
#3536

SO I SAY,it only add a new export api in WebView2Loader.dll ,you did'nt need make a exe.
WebView2Loader.dll also can show a window,or open url to show edge bowser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants