[Question] Is it possible to host a WebView control in a C++ Win32 app?
Hello,
I am trying to host a WebView control (Windows::UI::Xaml::Controls::WebView) in my C++ Win32 app.
I saw that the docs listed the following as a limitation:
Adding a WebView control to a custom user control (either on-thread, off-thread, or out of process).
For that reason I followed the Host a standard UWP control instructions. Since it's not a "custom control" I assumed it would work.
However, with the following code, an exception (hresult_error) is always raised on the Navigate method call.
Windows::UI::Xaml::Controls::WebView wv;
wv.Navigate(Windows::Foundation::Uri(L"https://bing.com"));
My use-case is that I want to place a WebView inside a UWP StackPanel or similar control. Is there something I'm missing, or are WebView controls not supported at all in Win32?
Thank you, Max
Hello mnxn, thank you for your interest in Win32!
I have automatically added a "needs triage" label to help get things started. Our team will look into the question and answer ASAP. Other community members may also answer the question and provide feedback 🙌
Hi @mnxn, I'd suggest trying the WebView2 preview for your scenario. It will be replacing the WebView in this repository, and their current preview is geared towards C++ hosting.