79476050

Date: 2025-02-28 15:58:09
Score: 1.5
Natty:
Report link

Achieved. My mistake were I need to wait the WebView2 to complete. The correct code is:

std::string htmlContent = R"(
    <html>
    <body>
        <h1>Hello world!</h1>
    </body>
    </html>
    )";
MyWebView.EnsureCoreWebView2Async().Completed([MyWebView,htmlContent](auto&&, auto&&) {
    MyWebView.NavigateToString(winrt::to_hstring(htmlContent));
});
Reasons:
  • Blacklisted phrase (0.5): I need
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Vicente Flich