MFC: Modify build EXE file icon

Source: Internet
Author: User

Online look for a bit, probably can summarize has

Method One:
To change the icon, you can see the ID value of each resource after opening in Resource.h, general MFC Auto-generated IDR_MAINFRAME is 128, it will add more than 128, the sequential delay, compile by default will be the smallest ID as exe icon, So as long as we can change it, or the above dialog box, change Idi_icon1 to 128, change the idr_mainframe to another larger number can not be too large, because there may be other uses, and then re-rebuild, At this point, you can see the EXE icon has become its own idi_icon1 icon.

Method Two:
1, in the Program Res folder, delete the MFC icon file, add their own icon file;

2. In the Properties dialog box of the icon idr_mainframe, modify the file name path to your own icon files.

  

Self According to two methods are changed, but debug and realease compile generated program icons have not changed, did not have the result of the afternoon;

But when I saw this blog post 50644792, clairvoyant

In fact, the icon has been changed, but due to system problems, the cache is not refreshed, so the change of the icon is not shown, just to rebuild the cache can be.

  

Build a TXT file under the project to add:

REM Shut down Windows Explorer

taskkill/f/im Explorer.exe

REM Cleanup System icon Cache database

Attrib-h-s-r "%userprofile%\appdata\local\iconcache.db"

del/f "%userprofile%\appdata\local\iconcache.db"

attrib/s/d-h-s-r "%userprofile%\appdata\local\microsoft\windows\explorer\*"

del/f "%userprofile%\appdata\local\microsoft\windows\explorer\thumbcache_32.db"

del/f "%userprofile%\appdata\local\microsoft\windows\explorer\thumbcache_96.db"

del/f "%userprofile%\appdata\local\microsoft\windows\explorer\thumbcache_102.db"

del/f "%userprofile%\appdata\local\microsoft\windows\explorer\thumbcache_256.db"

del/f "%userprofile%\appdata\local\microsoft\windows\explorer\thumbcache_1024.db"

del/f "%userprofile%\appdata\local\microsoft\windows\explorer\thumbcache_idx.db"

del/f "%userprofile%\appdata\local\microsoft\windows\explorer\thumbcache_sr.db"

REM Cleaning system Tray memory icon

echo y|reg Delete "hkey_classes_root\local settings\software\microsoft\windows\currentversion\traynotify"/ V IconStreams

echo y|reg Delete "hkey_classes_root\local settings\software\microsoft\windows\currentversion\traynotify"/ V PastIconsStream

rem Restart Windows Shell Explorer

Start explorer

Named Xxx.bat, Notepad, select Save As, all files

MFC: Modify build EXE file icon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.