@@ -27,26 +27,27 @@ applies the color too late.
27
27
``` cpp
28
28
HRESULT AppWindow::CreateControllerWithOptions ()
29
29
{
30
- wil::com_ptr<ICoreWebView2ControllerOptions4> options4 ;
30
+ wil::com_ptr<ICoreWebView2ControllerOptions> options ;
31
31
HRESULT hr = m_environment->CreateCoreWebView2ControllerOptions(&options);
32
32
33
33
if (hr == E_INVALIDARG)
34
34
{
35
+ ShowFailure (hr, L"Invalid profile name.");
35
36
return S_OK;
36
37
}
37
38
38
39
wil::com_ptr<ICoreWebView2ControllerOptions4> options4;
39
- auto result = options->QueryInterface(IID_PPV_ARGS(&stagingOptions ));
40
+ auto result = options->QueryInterface(IID_PPV_ARGS(&options4 ));
40
41
41
42
if (SUCCEEDED(result))
42
43
{
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);
45
46
}
46
47
47
48
m_environment->CreateCoreWebView2Controller(
48
49
m_mainWindow,
49
- SUCCEEDED (result) ? stagingOptions .Get() : options.Get(),
50
+ SUCCEEDED (result) ? options4 .Get() : options.Get(),
50
51
Callback<ICoreWebView2CreateCoreWebView2ControllerCompletedHandler >(
51
52
this, &AppWindow::OnCreateCoreWebView2ControllerCompleted).Get());
52
53
@@ -69,7 +70,7 @@ private void SetDefaultBackgroundColor()
69
70
{
70
71
CoreWebView2Environment environment = CoreWebView2Environment .CreateAsync ();
71
72
CoreWebView2ControllerOptions options = environment .CreateCoreWebView2ControllerOptions ();
72
- options .DefaultBackgroundColor = Color .FromArgb (0 , 0 , 255 );
73
+ options .DefaultBackgroundColor = Color .FromArgb (255 , 85 , 0 , 255 );
73
74
WebView2 .EnsureCoreWebView2Async (environment , options );
74
75
}
75
76
0 commit comments