Archived

This topic is now archived and is closed to further replies.

Icons

This topic is 5147 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how do i replace the default application icon for my exe file? I have created the icon already, in 32x32. Tried consulting the MSDN, but can''t figure out how to do it. Google search returns VB stuff mainly.

Share this post


Link to post
Share on other sites
that only changes the icon on your window. THe icon you see in explorer is just the icon resource with the lowest if value. To change the ID value of an icon, type something like this IDI_APPICON = 1000

My Site

[edited by - Quasar3D on November 9, 2003 2:37:59 PM]

Share this post


Link to post
Share on other sites
Hi...
tried the methods you guys suggested.

I added a resource to the project, and imported my ico file. renamed it IDI_APPICON. The value given initially is 102, but I changed it to 1 in resource.h (is that the lowest value?)

my hIcon parameter was changed as well, (seemed to need that makintresource to work).

wc.hIcon=LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPICON));

with no more errors, e icon still doesnt stick... still ugly app icon...any idea what''s wrong?

Share this post


Link to post
Share on other sites
Umm I think he's talking about the lowest value for the icons not the lowest value in the resource file. The lowest value of an icon is the default icon used with your executable I think, if you just want to change the icon in your window then just load the icon with any value. Are you talking about the small icon on the left hand corner of the window? Then you have to load it in the hIconSm parameter the one you are changing is the icon that's displayed when you press alt-tab to switch windows...


[edited by - FtMonkey on November 10, 2003 11:29:31 AM]

Share this post


Link to post
Share on other sites
I'm referring to the main icon, that will replace the default exe icon (not the one when i alt-tab)... can't get it to work

I'm using WNDCLASS btw. And do I need to put the .ico file together in the same folder with the exe for the exe icon to change to the .ico one?

[edited by - ongky on November 10, 2003 2:18:01 PM]

Share this post


Link to post
Share on other sites
Ermm it should work as long as your icon resource has the lowest id of all of the other icons. Have you tried starting a new project and repeating the process? Maybe you messed up something or maybe windows is failing to load the icon for some reason, I'm just guessing though never had any problems like that...Since the icon is in your resource file then it doesn't need to be in the same folder.

[edited by - FtMonkey on November 10, 2003 4:48:54 PM]

Share this post


Link to post
Share on other sites
What compiler are you using? It seems like that VS.NET (In my case), makes an icon called icon.ico or sometime and uses that as the progam icon. I just simply changed that icon.



Toolbar: [ WiseElben.com | My Journal | nMagic | My Profile ]

"Give a man a fish and he will eat for a day. Teach a man how to fish and he will eat for a life time."
-Chinese Proverb

Share this post


Link to post
Share on other sites
And do I need to put the .ico file together in the same folder with the exe for the exe icon to change to the .ico one?

It should have included the icon in the exe resource when you compiled your program.



Toolbar: [ WiseElben.com | My Journal | nMagic | My Profile ]

"Give a man a fish and he will eat for a day. Teach a man how to fish and he will eat for a life time."
-Chinese Proverb

Share this post


Link to post
Share on other sites
hi ppl... thanks for ur replies... i found out the problem. Quite stupid really, my mistake. When I imported the .ico file, somehow it was saved as a BITMAP, rather than an ICON. Think i overlooked that point, and kept messing around with other stuff.
So the WNDCLASS accepts nothing but Icons

I just copied the imported bitmap, created a new icon with the resource editor, and pasted the stuff and saved a new icon tt looks exactly the same. Another thing was that in .hIcon, the thing needs the " ". And yes, the .ico file does not need to be in the same folder!

Cheers!

Btw, I found out the problem after referring to someone else's work. I just downloaded the zip, and it had the source files. The first thing i noticed was that his .exe was not the default application icon, so I dived right into his workspace Perhaps this is a good way to check your mistakes as well!

[edited by - ongky on November 10, 2003 6:27:30 PM]

Share this post


Link to post
Share on other sites
Just in case you didn't know the reason why you don't need the icons to be in the same folder is because your resource gets compiled into the exe file as well. So in other words you don't even need an external .ico file in the first place, once it is in your resource file of course

[edited by - FtMonkey on November 10, 2003 7:04:20 PM]

Share this post


Link to post
Share on other sites