简体   繁体   中英

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.

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 .

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.

One option would be to put your icons in a separate module, ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM