diff --git a/Client/core/DXHook/CProxyDirect3D9.cpp b/Client/core/DXHook/CProxyDirect3D9.cpp index 40330e96961..bc0d5fb0687 100644 --- a/Client/core/DXHook/CProxyDirect3D9.cpp +++ b/Client/core/DXHook/CProxyDirect3D9.cpp @@ -11,6 +11,9 @@ #include "StdInc.h" #include +#include + +extern HINSTANCE g_hModule; HRESULT HandleCreateDeviceResult(HRESULT hResult, IDirect3D9* pDirect3D, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface); @@ -172,6 +175,23 @@ HRESULT CProxyDirect3D9::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND BOOL darkTitleBar = GetSystemRegistryValue((uint)HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme") == "\x0"; DwmSetWindowAttribute(hFocusWindow, DWMWA_USE_IMMERSIVE_DARK_MODE, &darkTitleBar, sizeof(darkTitleBar)); + // Update icon + if (HICON icon = LoadIcon(g_hModule, MAKEINTRESOURCE(IDI_ICON1))) + { + const auto paramIcon = reinterpret_cast(icon); + for (const WPARAM size : {ICON_SMALL, ICON_BIG}) + { + SendMessage(hFocusWindow, WM_SETICON, size, paramIcon); + } + + // Clean + DestroyIcon(icon); + } + + // Redraw, we avoid possible problems with the fact that it won't replace the icon somewhere + InvalidateRect(hFocusWindow, nullptr, TRUE); + UpdateWindow(hFocusWindow); + // Detect if second call to CreateDevice if (CreateDeviceSecondCallCheck(hResult, m_pDevice, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface)) {