Vida Marcell Posted December 6, 2021 Share Posted December 6, 2021 Hi everyone, how can i change the icon of the window? Quote Link to comment Share on other sites More sharing options...
Josh Posted December 7, 2021 Share Posted December 7, 2021 http://www.angusj.com/resourcehacker/ 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted December 7, 2021 Share Posted December 7, 2021 I there was the correct way of doing this on this form. I probably should write a blog to centralize the information. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
SlipperyBrick Posted February 25, 2022 Share Posted February 25, 2022 Ripped from an old thread I posted in ... back when I too pondered over the horrors of changing my applications icon. On 3/24/2021 at 9:00 AM, SlipperyBrick said: What a painful experience. For anyone who is looking to do the same you need to follow this process: In Solution Explorer find the "Resource Files" folder (if you work in "Show all files" mode like I do you may need to switch to see the folder) Right click "Resource Files" folder and select Add > Resource... From the window dialog select "Icon" and choose "Import" (your icon must be .ico format) With those steps complete, head over to wherever you have created your window and add the following code: // Get device context HWND hwnd = m_Window->GetHandle(); HDC hdc = GetDC(hwnd); // Load the icon for window titlebar and taskbar HICON icon = LoadIconA(GetModuleHandle(NULL), (LPCSTR)IDI_ICON1); SendMessage(hwnd, WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icon)); I would recommend to clean up your projects directory by added a "res" folder and dragging in the files that were created when you added a resource to your project. P.S. It should go without saying but whatever variable name you have provided for your window (mine is m_Window) replace that with your own. All jokes aside it wasn't that difficult, the worst part was trawling through the Win32 API reference and hitting dozens of deprecated pages. @reepblue looking forward to the blog post ? 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted February 25, 2022 Share Posted February 25, 2022 I believe that's the exact soultion I used. Sorry I never did a blog post about it. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.