From 33de2779008a13bbeb840c6620bacf2ace19892f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laci=20b=C3=A1?= <84271678+laciba96@users.noreply.github.com> Date: Sat, 16 Oct 2021 18:18:34 +0200 Subject: [PATCH] Fixing the main window's icon in the title bar --- src/win/win_ui.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 9b1f64d5d..a099489aa 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -1304,13 +1304,19 @@ ui_init(int nCmdShow) wincl.lpfnWndProc = MainWindowProcedure; wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof(WNDCLASSEX); - wincl.hIcon = LoadIcon(hinstance, (LPCTSTR)10); - wincl.hIconSm = LoadIcon(hinstance, (LPCTSTR)10); + wincl.hIcon = NULL; + wincl.hIconSm = NULL; wincl.hCursor = NULL; wincl.lpszMenuName = NULL; wincl.cbClsExtra = 0; wincl.cbWndExtra = 0; wincl.hbrBackground = CreateSolidBrush(RGB(0,0,0)); + + /* Load proper icons */ + wchar_t path[MAX_PATH + 1] = {0}; + GetModuleFileNameW(hinstance, path, MAX_PATH); + ExtractIconExW(path, 0, &wincl.hIcon, &wincl.hIconSm, 1); + if (! RegisterClassEx(&wincl)) return(2); wincl.lpszClassName = SUB_CLASS_NAME;