Hi ,

I am working with MFC SDI application,
when i open any project [ SDI ] default icon gets loaded
[ ie MFC icon ] , i am not able to change it , even i tried
modifying the icon file, only the ABOUTDialog box icon changes,
at all the other places , the icons ie (ex: tool bar ) still show's default MFC ICON.Pls help. i might be doing something wrong :(

Thanks in advance

Dani AI

Generated

Good catch by — that symptom (About box shows your icon but other places still show the MFC icon) usually comes from two separate causes: different UI elements ask Windows for different sizes/color-depths from the same .ico, and some UI (like toolbars) uses separate bitmap/image-list resources. is also right to point out that older advice about “two images” is outdated — modern .ico resources commonly contain several entries (16x16, 32x32, 48x48, 256x256, etc.) and different color/depth variants.

Why it matters: Windows picks the best-matching image from the .ico for each context (title bar small icon, Alt–Tab large icon, Explorer thumbnails). If a matching size/depth is missing the OS will scale or fall back, and results can look like the default MFC icon. To be robust, include the standard sizes and supply true-color (32-bit) images with alpha for modern Windows so scaling and transparency behave correctly.

If you need to force the frame/window icons in MFC, set both large and small icons explicitly (call from OnCreate or OnInitDialog):

HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
SetIcon(hIcon, TRUE);   // large (Alt-Tab)
SetIcon(hIcon, FALSE);  // small (title bar)

Note on toolbars: toolbar buttons are often separate bitmaps or image lists, not taken from the .ico. To change those, replace the toolbar bitmap resource or load a 32-bit image list and attach it with GetToolBarCtrl().SetImageList(...). For crisp results on high‑DPI systems, use 32‑bit RGBA images or 256×256 PNG-backed icons where supported.

Final troubleshooting tips: clean and rebuild resources, confirm the correct resource ID is used by the app, search for duplicate icon resources in linked modules, and if Explorer still shows the old icon restart Explorer (Windows caches icons).

Recommended Answers

All 3 Replies

There are two images in the icon resource, you either have to modify both of them or simply delete one image.

Actuall i got the solution, there is only one image icon for any project what mistake i did was to just modify only 48 * 48 SIZE image , now i modiffied all the images its working fine.

how did i do it :

1) click on the image
2) go to the image menu
3) Current Icon Image types
Here different sizes of images are present
modify all of them tats it :). There will only be one icon
(.ico) file for one project ( i mean the images which is used for tool bar, exe etc )

Uh-oh, seems that I managed to post highly out-dated information, sorry about that one. (There used to be 2 images in a single icon resource, but nowadays there are many more).

Good job that you had it working though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.