@@ -27,26 +27,27 @@ applies the color too late.
2727``` cpp
2828 HRESULT AppWindow::CreateControllerWithOptions ()
2929{
30- wil::com_ptr<ICoreWebView2ControllerOptions4> options4 ;
30+ wil::com_ptr<ICoreWebView2ControllerOptions> options ;
3131 HRESULT hr = m_environment->CreateCoreWebView2ControllerOptions(&options);
3232
3333 if (hr == E_INVALIDARG)
3434 {
35+ ShowFailure (hr, L"Invalid profile name.");
3536 return S_OK;
3637 }
3738
3839 wil::com_ptr<ICoreWebView2ControllerOptions4> options4;
39- auto result = options->QueryInterface(IID_PPV_ARGS(&stagingOptions ));
40+ auto result = options->QueryInterface(IID_PPV_ARGS(&options4 ));
4041
4142 if (SUCCEEDED(result))
4243 {
43- COREWEBVIEW2_COLOR wvColor{255, 223, 225 , 225};
44- stagingOptions ->put_DefaultBackgroundColor(wvColor);
44+ COREWEBVIEW2_COLOR wvColor{255, 85, 0 , 225};
45+ options4 ->put_DefaultBackgroundColor(wvColor);
4546 }
4647
4748 m_environment->CreateCoreWebView2Controller(
4849 m_mainWindow,
49- SUCCEEDED (result) ? stagingOptions .Get() : options.Get(),
50+ SUCCEEDED (result) ? options4 .Get() : options.Get(),
5051 Callback<ICoreWebView2CreateCoreWebView2ControllerCompletedHandler >(
5152 this, &AppWindow::OnCreateCoreWebView2ControllerCompleted).Get());
5253
@@ -69,7 +70,7 @@ private void SetDefaultBackgroundColor()
6970{
7071 CoreWebView2Environment environment = CoreWebView2Environment .CreateAsync ();
7172 CoreWebView2ControllerOptions options = environment .CreateCoreWebView2ControllerOptions ();
72- options .DefaultBackgroundColor = Color .FromArgb (0 , 0 , 255 );
73+ options .DefaultBackgroundColor = Color .FromArgb (255 , 85 , 0 , 255 );
7374 WebView2 .EnsureCoreWebView2Async (environment , options );
7475}
7576
0 commit comments