Replacing titlebar icon

Started by
17 comments, last by Endurion 18 years, 6 months ago
Quote:Original post by Endurion
Weird, try to open your exe with Resource Hacker (it's a nifty freeware tool allowing you to read and even modify the resources of exes and dlls). Look esp. at the resource sections and the ID. It should contain one Icon and one Icon Group. The id of the icon group should resemble the define you pass in LoadIcon.

Downloading it now. In the meantime I tried making a new 16x16*16 colours icon. Didn't work either. [evil]
Advertisement
Okay, my icons are labels as 1, and 2 (ordinal name) and they all have a green gearlike icon with 1033?

I tried all these numbers, always NULL
What error does GetLastError return after LoadIcon fails?

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Error 1813: The specified resource type cannot be found in the image file. [headshake] The icon works everywhere else. BTW, Thanks for all your help so far.
Aha, it seems that the resource type for the icon is wrongly added. There are several predefined resource types (for icons it's RT_ICON) and it seems that your icon got the wrong type associated with it.

The entry in the .rc-file should look something like this:

IDR_MAINFRAME ICON "res\\AddressBook.ico"

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Quote:Original post by Endurion

The entry in the .rc-file should look something like this:

IDR_MAINFRAME ICON "res\\AddressBook.ico"
That is what my entry looks like.

IDR_ICO_MAIN ICON "c:\code\gamename\gamename.ico"

Difference?

Looks correct to me. Truly weird.

Have you tried using LoadImage instead of LoadIcon? AFAIK LoadImage is a bit more easy on the image types.

Would be interesting what resource types EnumResourceTypes comes up with as LoadIcon doesn't seem to find the RT_ICON type.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

If it wasn't an icon, why would it work in explorer for my .exe? Yes this is very odd. Could be that I'm using infraview to save my icon. Do you know a freeware program that I could use to load/save it?

-edit- LoadImage fails for the same reason.
Sorry, i'm out of ideas. And i don't know any icon editing program either, since i paint my icons in Visual Studio itself.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement