I'm currently trying to display a webview in a WinRT application (without c#). First, is it possible ?
I'm currently trying to do it that way:
Windows::UI::Xaml::Controls::WebView^ webView = ref new Windows::UI::Xaml::Controls::WebView();
webView->NavigateToString("http://www.google.com");
But as I want this code to be run in the main thread (I think, to create a UI element it's compulsory) I'm running it like that:
Windows::ApplicationModel::Core::CoreApplication::MainView->CoreWindow->GetForCurrentThread()->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler(
[]
{
Windows::UI::Xaml::Controls::WebView^ webView = ref new Windows::UI::Xaml::Controls::WebView();
webView->NavigateToString("http://www.google.com");
}
));
Bad point is that this line:
webView->NavigateToString("http://www.google.com");
Is never reached. In the output console I have three exceptions raised (while debugging step by step) at that line:
Windows::UI::Xaml::Controls::WebView^ webView = ref new Windows::UI::Xaml::Controls::WebView();
The exceptions raised are the following:
First-chance exception at 0x763B4B32 in Direct3DApp1.exe: Microsoft C++ exception: Platform::WrongThreadException ^ at memory location 0x0320EFE4. HRESULT:0x8001010E
First-chance exception at 0x763B4B32 in Direct3DApp1.exe: Microsoft C++ exception: Platform::WrongThreadException ^ at memory location 0x0320EFE4. HRESULT:0x8001010E
First-chance exception at 0x763B4B32 (KernelBase.dll) in Direct3DApp1.exe: 0x40080201: WinRT originate error (parameters: 0x8001010E, 0x00000051, 0x0320E494).
If you have any idea how to create a webview and display it in a C++ only application on Windows 8 (not Windows Phone 8), it would be great. Meanwhile I'm strongly thinking about integrating webkit in my application if it could help me to display a
webkit webview in C++ only.
Thx