Hey guys,
I made a program and i was just wondering how to change the icon because right now all its showing is the application file icon.

So
Any help is appreciated.

Thanks!

P.S: I already tried resource hacker, and I probably did something wrong but it didn't work.

Dani AI

Generated

Short expert summary and practical next steps.

There are two things people mix up: the file/icon that Explorer shows (the executable's icon resource) and the icon shown in your window titlebar or Alt+Tab (the window class or WM_SETICON icon). Embedding a multi-resolution .ico into your build is the clean, repeatable way to change both; editing an already-built .exe with a resource tool can work (as found) but is a post-build hack and can break signatures or be cached by Windows. This complements 's Win32 direction and 's resource-editor comment.

How to embed (minimal example — add these files to your project so the resource compiler includes them):

/* resource.h */
#define IDI_MAINICON 101

/* myapp.rc */
#include "resource.h"
IDI_MAINICON ICON "myicon.ico"

Also make sure the running window uses that icon (set hIcon / hIconSm in your WNDCLASSEX or send WM_SETICON after CreateWindow).

What to put in the .ico

  • Include multiple sizes: 16x16, 32x32, 48x48 and 256x256 (256 is used by modern Explorer and high-DPI displays).
  • Use 32-bit color with alpha for best-looking edges; include a PNG-compressed 256x256 entry for Vista+ behavior.
  • A single-resolution ICO will look wrong at some sizes; pack several variants.

Troubleshooting & cautions

  • Rebuild/clean the project after changing resources. Close the app before editing the exe. Windows caches icons — copy the EXE to a new folder or restart Explorer / reboot to force an update. Editing a signed binary invalidates its signature. If you are using an Express edition with no GUI resource editor, a plain .rc text file added to the project compiles fine and achieves the same result.

Recommended Answers

All 10 Replies

Does your program run in a window, or is it a command line program?

runs in a window

Try reading this tutorial. It explains how to create menus and icons for win32. You may need to read back a page or two depending on how much you already know.

thanks

'm kinda new at this so I really didn't understand one word of it....is there any simpler way to make an icon?

It isn't difficult, you just need to read the tutorial... There is a section on that site which has downloadable examples as well.

Hm....found it! Thanks!

NubTruck's approach is correct if you have a Win32API application. I was asking about that because if you were using a different GUI API, the approach would be different.

If you are using the Express Edition of Visual Studio, it is "missing" a resource editor (resources being all the "baggage" your application can carry, icons, bitmaps, etc.). You have to generate your own resource scripts to be fed into the resource compiler that does come with the EE.

Something like http://www.resedit.net/ (not affiliated with this product) gives you back that resource editing. Have a look at that. Regardless, I would take Nubtruck's advice and take a few steps back in that tutorial to see where you first stopped understanding. If you are going to get into this sort of thing, the fundamentals are important.

Hey guys,
I got the icon thing to work(it was pretty easy actually, you just have to download and the Resource Editor then load icofx, go to tools, resource editor, click on folder icon, open your .exe file in the Dubug part of your folder, and then click on add an icon and voila, go to the folder that has the icon you want, load it, and save it!).

Hey guys,
I made a program and i was just wondering how to change the icon because right now all its showing is the application file icon.

So
Any help is appreciated.

Thanks!

P.S: I already tried resource hacker, and I probably did something wrong but it didn't work.

bad post

bad post(again)

There is an edit button(under your username and avatar) <<------------------------------<< that works for up to 30 minutes after you've made the post.

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.