How to update Icon for exe (MAINICON)?

youki 1,021 Reputation points
2023-09-05T13:21:41.9366667+00:00

I added an icon for the exe by adding the ico to the resources and MAINICON in code of myProject.rc, after compiling and using "Start Without Debugging", the icon appeared:

https://stackoverflow.com/questions/2393863/set-an-exe-icon-for-my-program

I can't update the icon. When i add another icon and execute the same steps, it always has the old icon. How can i update it easily?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,628 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,737 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. David Lowndes 2,535 Reputation points MVP
    2023-09-05T13:27:23.7033333+00:00

    As a sanity check open your EXE in Visual Studio and make sure the new icon resource has replaced the prior one.
    Assuming it has, you're probably seeing the old icon in Explorer due to the Windows icon cache - see here.

    1 person found this answer helpful.
    0 comments No comments

  2. youki 1,021 Reputation points
    2023-09-05T16:31:52.1466667+00:00

    Ty @David Lowndes , it helped with the icon of the exe file.

    I also had to clear the cache of the system tray to update the BalloonTip icon on the title bar, it also takes the MAINICON.

    https://learn.microsoft.com/en-us/windows/win32/controls/implement-tooltips-for-status-bar-icons

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.