MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / SetAppIcon

Method SetAppIcon

SampleApps/WebView2APISample/AppWindow.cpp:2095–2108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2093}
2094
2095void AppWindow::SetAppIcon(bool inPrivate)
2096{
2097 int iconID = inPrivate ? IDI_WEBVIEW2APISAMPLE_INPRIVATE : IDI_WEBVIEW2APISAMPLE;
2098
2099 HICON newSmallIcon = reinterpret_cast<HICON>(
2100 LoadImage(g_hInstance, MAKEINTRESOURCEW(iconID), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR));
2101 HICON newBigIcon = reinterpret_cast<HICON>(
2102 LoadImage(g_hInstance, MAKEINTRESOURCEW(iconID), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR));
2103
2104 reinterpret_cast<HICON>(SendMessage(
2105 m_mainWindow, WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(newSmallIcon)));
2106 reinterpret_cast<HICON>(
2107 SendMessage(m_mainWindow, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(newBigIcon)));
2108}
2109
2110// This is the callback passed to CreateCoreWebView2Controller. Here we initialize all
2111// WebView-related state and register most of our event handlers with the WebView.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected