|
11 | 11 |
|
12 | 12 | #include "StdInc.h"
|
13 | 13 | #include <dwmapi.h>
|
| 14 | +#include <resource.h> |
| 15 | + |
| 16 | +extern HINSTANCE g_hModule; |
14 | 17 |
|
15 | 18 | HRESULT HandleCreateDeviceResult(HRESULT hResult, IDirect3D9* pDirect3D, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags,
|
16 | 19 | D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface);
|
@@ -172,6 +175,23 @@ HRESULT CProxyDirect3D9::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND
|
172 | 175 | BOOL darkTitleBar = GetSystemRegistryValue((uint)HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme") == "\x0";
|
173 | 176 | DwmSetWindowAttribute(hFocusWindow, DWMWA_USE_IMMERSIVE_DARK_MODE, &darkTitleBar, sizeof(darkTitleBar));
|
174 | 177 |
|
| 178 | + // Update icon |
| 179 | + if (HICON icon = LoadIcon(g_hModule, MAKEINTRESOURCE(IDI_ICON1))) |
| 180 | + { |
| 181 | + const auto paramIcon = reinterpret_cast<LPARAM>(icon); |
| 182 | + for (const WPARAM size : {ICON_SMALL, ICON_BIG}) |
| 183 | + { |
| 184 | + SendMessage(hFocusWindow, WM_SETICON, size, paramIcon); |
| 185 | + } |
| 186 | + |
| 187 | + // Clean |
| 188 | + DestroyIcon(icon); |
| 189 | + } |
| 190 | + |
| 191 | + // Redraw, we avoid possible problems with the fact that it won't replace the icon somewhere |
| 192 | + InvalidateRect(hFocusWindow, nullptr, TRUE); |
| 193 | + UpdateWindow(hFocusWindow); |
| 194 | + |
175 | 195 | // Detect if second call to CreateDevice
|
176 | 196 | if (CreateDeviceSecondCallCheck(hResult, m_pDevice, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface))
|
177 | 197 | {
|
|
0 commit comments