From d66135f4b8f25ec6bdbf7f7756ad2f6131ccf2f4 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 6 Aug 2015 14:35:12 +0200 Subject: [PATCH] Add ability to change window icon after window has already opened on Windows --- panda/src/windisplay/winGraphicsWindow.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index a226dcde1b..0146f2f89c 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -284,6 +284,17 @@ set_properties_now(WindowProperties &properties) { properties.clear_title(); } + if (properties.has_icon_filename()) { + HICON icon = get_icon(properties.get_icon_filename()); + if (icon != 0) { + ::SendMessage(_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)icon); + ::SendMessage(_hWnd, WM_SETICON, ICON_BIG, (LPARAM)icon); + + _properties.set_icon_filename(properties.get_icon_filename()); + properties.clear_icon_filename(); + } + } + if (properties.has_cursor_hidden()) { bool hide_cursor = properties.get_cursor_hidden(); _properties.set_cursor_hidden(hide_cursor);