user2058002
user2058002

Reputation:

Add icon resource without changing the EXE icon?

I've added an icon resource to my program. Unfortunately, it's a 16x16 icon meant as a visual aid on a button, and now it's set as the executable's main icon. Obviously, this looks terrible.

Is it possible to add a resource while retaining the EXE's icon as the Windows default?

I'm using Visual Studio 2010, if that helps.

Upvotes: 5

Views: 936

Answers (3)

David Heffernan
David Heffernan

Reputation: 613442

One option would be to put your icons in a separate module, i.e. a DLL. This would stop the system using them for application icons and avoid the need to add your own copy of the default system application icon.

Upvotes: 0

Atiq Rahman
Atiq Rahman

Reputation: 678

You can do it manually. You can add an identifier in resource.h, rc file and then use it by calling required function with parameter MAKEINTRESOURCE(IDENTFIER) to make the cast from id to image.

Upvotes: 0

Frédéric Hamidi
Frédéric Hamidi

Reputation: 263107

It looks like your 16x16 icon is the only icon resource in your application, or the one with the smallest identifier. In that case, both Explorer (for its file lists) and the window manager (for the window's title bar) will default to that icon.

You should add another icon to your application, with an id less than the id of your 16x16 icon, so it will become the default icon. If you want to use the default application icon, you can get it from the Visual Studio Image Library.

Upvotes: 4

Related Questions