I am using MS Visual C++ 6.0,
I have an icon that I made in Visual C++. Is there a way that I can compile my program so that the final .exe file has the icon I made, not the usual icon?
Thanks
I am using MS Visual C++ 6.0,
I have an icon that I made in Visual C++. Is there a way that I can compile my program so that the final .exe file has the icon I made, not the usual icon?
Thanks
The application should be built automatically with the icon with the lowest id that's part of the executable's resources.
If the application is non-console then you'll have to take extra steps if you want the window icon to be the one you want. For example, in winapi you would either register the window class with the icon you want or send a WM_SETICON message.
This is a windows specific question so I'm moving it there.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
So, to facilitate all that, you first need a resource file, which can be as simple as:-
Save that with an .rc extension and add it to your project's Resource Files folder.Code:#include "resource.h" IDI_ICON ICON "icon.ico"
You'll also need a resource.h to include, which can say:-
Note the second line. There's a problem with Microsoft's resource compiler (which bizarrely still hasn't been fixed after several service packs) that makes it fail to recognize the end of file condition unless there's an empty line at the end. I don't know whether this has been fixed in later releases.Code:#define IDI_ICON 100
That should get you an icon called icon.ico from your project's directory into your program, then you simply have to do as Ken suggested to use it the usual way.
Thanks man. You rock!