icons in dev-c

Started by
4 comments, last by jon_gamedev 18 years, 4 months ago
Hello, A simple question, perhaps? I am trying to change the default icon in a simple windows program. I get no compile errors, but the icon hasn't changed when i run it. I have a simple rc file with the line: jonicon ICON C:\Dev-Cpp\book.ICO and then in the main program i have winclass.hIcon = LoadIcon(NULL, "jonicon"); The program compiles with no errors, but when it runs the icon in the upper corner, or when minimized is still the default icon. I noticed something else strange: When i change the line winclass.hIcon = LoadIcon(NULL, "jonicon"); to winclass.hIcon = LoadIcon(NULL, "aaaajonicon"); it still compiles without error even though there is no icon named aaajonicon. Does anybody have any suggestions? Thanks
Advertisement
I suggest you read this.

Try changing your code to this:
    winclass.hIcon  = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(jonicon));    winclass.hIconSm  = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(jonicon), IMAGE_ICON, 16, 16, 0);


hippopotomonstrosesquippedaliophobia- the fear of big words
Try this:
//icon.h (or similar)#define jonicon 101//in the resource file#include "icon.h"...jonicon ICON "C:\Dev-Cpp\book.ICO"//in the code#include "icon.h"...winclass.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(jonicon));

Also, I had a problem similar to this when I had two resource files. The second one was getting compiled, but the app couldn't find the resources it defined. Since it defined the icon resource, my icon was never being used. Once I finally put all the resource definitions in one file, it magically worked properly.
First, I have to say i am very impressed by this forum. There is alot of knowledge here, and people are VERY helpful.

But,alas, i still cant seem to get this to work. I will play with it for a couple more days, and let you know what happens. Thanks for the help!

Jonathan
Quote:Original post by jon_gamedev
First, I have to say i am very impressed by this forum. There is alot of knowledge here, and people are VERY helpful.

But,alas, i still cant seem to get this to work. I will play with it for a couple more days, and let you know what happens. Thanks for the help!

Jonathan

Try posting all your relevent code.
hippopotomonstrosesquippedaliophobia- the fear of big words
I got it all figured out. I appreciate the kind help and advice given, but i must admit it was a silly mistake on my part. The way i first described doing the icons DOES work in DEV-C..

my mistake was somehow putting another winclass.hIcon statement that reloaded the default icon after i loaded my custom icon. Next time, i will take more time to check my code for such silly mistakes before i ask for help. Sorry.

Jonathan

This topic is closed to new replies.

Advertisement