@@ -290,7 +290,7 @@ PCWSTR AppWindow::GetWindowClass()
290290 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1 );
291291 wcex.lpszMenuName = MAKEINTRESOURCEW (IDC_WEBVIEW2APISAMPLE);
292292 wcex.lpszClassName = windowClass;
293- wcex.hIconSm = LoadIcon (g_hInstance, MAKEINTRESOURCE (IDI_SMALL ));
293+ wcex.hIconSm = LoadIcon (g_hInstance, MAKEINTRESOURCE (IDI_WEBVIEW2APISAMPLE ));
294294
295295 RegisterClassExW (&wcex);
296296 return windowClass;
@@ -1465,26 +1465,13 @@ HRESULT AppWindow::CreateControllerWithOptions()
14651465
14661466void AppWindow::SetAppIcon (bool inPrivate)
14671467{
1468- HICON newSmallIcon = nullptr ;
1469- HICON newBigIcon = nullptr ;
1470- if (inPrivate)
1471- {
1472- static HICON smallInPrivateIcon = reinterpret_cast <HICON>(LoadImage (
1473- g_hInstance, MAKEINTRESOURCEW (IDI_WEBVIEW2APISAMPLE_INPRIVATE), IMAGE_ICON, 16 , 16 ,
1474- LR_DEFAULTCOLOR));
1475- static HICON bigInPrivateIcon = reinterpret_cast <HICON>(LoadImage (
1476- g_hInstance, MAKEINTRESOURCEW (IDI_WEBVIEW2APISAMPLE_INPRIVATE), IMAGE_ICON, 32 , 32 ,
1477- LR_DEFAULTCOLOR));
1478- newSmallIcon = smallInPrivateIcon;
1479- newBigIcon = bigInPrivateIcon;
1480- }
1481- else
1482- {
1483- static HICON smallIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE (IDI_WEBVIEW2APISAMPLE));
1484- static HICON bigIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE (IDI_SMALL));
1485- newSmallIcon = smallIcon;
1486- newBigIcon = bigIcon;
1487- }
1468+ int iconID = inPrivate ? IDI_WEBVIEW2APISAMPLE_INPRIVATE : IDI_WEBVIEW2APISAMPLE;
1469+
1470+ HICON newSmallIcon = reinterpret_cast <HICON>(
1471+ LoadImage (g_hInstance, MAKEINTRESOURCEW (iconID), IMAGE_ICON, 16 , 16 , LR_DEFAULTCOLOR));
1472+ HICON newBigIcon = reinterpret_cast <HICON>(
1473+ LoadImage (g_hInstance, MAKEINTRESOURCEW (iconID), IMAGE_ICON, 32 , 32 , LR_DEFAULTCOLOR));
1474+
14881475 reinterpret_cast <HICON>(SendMessage (
14891476 m_mainWindow, WM_SETICON, ICON_SMALL, reinterpret_cast <LPARAM>(newSmallIcon)));
14901477 reinterpret_cast <HICON>(
@@ -1804,10 +1791,10 @@ void AppWindow::RegisterEventHandlers()
18041791 [this ]
18051792 {
18061793 std::wstring message =
1807- L" A new version of the Microsoft Edge WebView2 Runtime is available on this machine. " ;
1794+ L" We detected there is a new version for the browser. " ;
18081795 if (m_webView)
18091796 {
1810- message += L" Do you want to restart the WebView2APISample app? \n\n " ;
1797+ message += L" Do you want to restart the app? \n\n " ;
18111798 message +=
18121799 L" Click No if you only want to re-create the webviews. \n " ;
18131800 message += L" Click Cancel for no action. \n " ;
0 commit comments