CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Changing the icon for an exe file (in Windows Explorer)

    I've spent an entire morning searching the internet but amazingly, I can't find an answer to this...

    For the past few years I've been using MSVC to compile an particular program periodically. The exe contains an icon and if I navigate to the folder that contains the exe (in Windows Explorer) obviously I see the icon.

    But yesterday, the icon got changed and I had to re-compile the program. I linked the new icon into it but strangely, Windows Explorer still displays it with the older icon. I downloaded a product called IconViewer and used it to examine my newly built exe. Sure enough, it only contains the new icon. And if I create a shortcut to the exe, the shortcut gets created with the new icon - but for the exe itself, Windows Explorer stubbornly carries on displaying the old icon and I can't find any way to update it. Even deleting the exe and totally rebuilding it still leaves Explorer displaying the old icon.

    Any ideas anyone..?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Changing the icon for an exe file (in Windows Explorer)


  3. #3
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: Changing the icon for an exe file (in Windows Explorer)

    Thanks Arjay,

    The only thing that seemed relevant there was the advice on how to change the icon for an (already running) program by selecting it from the Windows taskbar. However, that didn't seem to work for me. If the program got started from a shortcut, those instructions did change the icon for the relevant shortcut - but I haven't yet found any simple way to change the icon for an actual exe file. Once Windows has decided on the icon, you're pretty much stuck with it AFAICT.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Changing the icon for an exe file (in Windows Explorer)

    Quote Originally Posted by John E View Post
    Thanks Arjay,

    The only thing that seemed relevant there was the advice on how to change the icon for an (already running) program by selecting it from the Windows taskbar. However, that didn't seem to work for me. If the program got started from a shortcut, those instructions did change the icon for the relevant shortcut - but I haven't yet found any simple way to change the icon for an actual exe file. Once Windows has decided on the icon, you're pretty much stuck with it AFAICT.
    Search the registry for the exe name. You should see in entry related to the icon (it's an ordinal into the exe).

  5. #5
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: Changing the icon for an exe file (in Windows Explorer)

    An interesting development this afternoon...

    I happen to be compiling the exe onto a removable drive. So I decided to attach the drive to some different OS's. Guess what... Windows XP, Windows 7 and Windows 10 all see the correct icon. Only Windows 8.1 continues to display the out-of-date version.

    So it looks like this is just a bug in Windows 8.1
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  6. #6
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: Changing the icon for an exe file (in Windows Explorer)

    So it looks like this is just a bug in Windows 8.1
    Upgrading to Windows 10 from Windows 8/8.1 is really a no-brainer and there's still time to do it for free...
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  7. #7
    Join Date
    Jul 2016
    Posts
    0

    Re: Changing the icon for an exe file (in Windows Explorer)

    I think there has several bugs in 8.1. Many of them are corrected in windows 10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured