Archived

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

Change the Icon of my OGL .exe...

This topic is 5004 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 you change the icon of an .exe file? i wrote this little openGL application so i go to right click-> properties and no button to change the icon, to my dismay and surprise. actually if i make a shortcut to it then yes you can change the icon, but that means there is an embedded path into the .exe and once you take it to another machine it will barf all over you and say "cannot find ../../MSVC../.exe, path has been removed or moved. i have this problem because my openGL app cannot run through a basic drag and drop. the .exe has to accept more than one argument, such like *.exe -t something.jpeg something.bmp. what i wanted to do was change the path in the properties of the .exe so you dont have to go to cmd line prompt and type that in. you can just double click. ********* so in essence can you change the icon of a .exe without the embedded shortcut path file name that windows creates when you do this?

Share this post


Link to post
Share on other sites
ok im asuming your using vcpp and are using the nehe basecode.

fist create a resourcefile and add the icon to that, the icon id should be IDI_ICON1.

then in the main file(where the winmain func is) just under the includes add this line

#define IDI_ICON1 102

then in function RegisterWindowClass or wherever you register the window class, somewhere before RegisterClassEx though.
add this(or replace if it allready exist).

windowClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));

It might not fit exactly into your code, but it''s a start.

---------------------------------
For an overdose of l33tness, flashbang.nu

Share this post


Link to post
Share on other sites
If your using NeHe basic openGL code then the above icon formatting should work properly. Just insert your specific words for winclass and IDI_ICON. I also think that MSVC++ will define the icon automatically in the resource.h files, so you dont exactly have to worry about that.

Share this post


Link to post
Share on other sites