Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / How to change the icon of the exe?

Author
Message
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 28th Jan 2008 16:36
It seems that Visual C++ 2008 expression edition can't add any resource files into a project. So how can I add a customed icon resource into the compiled exe?
Thanks.

Carlos
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 1st Feb 2008 09:10
No one answer my question......
But I have solved this problem by myself.

Carlos
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 1st Feb 2008 11:08
Hey you would contribute if posting your solution at the same time... Don't get upset because nobody knew the answer.
The Master
18
Years of Service
User Offline
Joined: 6th Nov 2005
Location:
Posted: 1st Feb 2008 21:52
what is the answer Carlos?

ico
17
Years of Service
User Offline
Joined: 17th Jun 2006
Location: Ottawa, Canada
Posted: 2nd Feb 2008 05:14
Instead of keeping this thread being utterly useless...
to change an icon, you can use a resource editor. i think.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 10th Apr 2008 15:18
i think doing it within vc++ is more elegant, and you won't have to change icon with every new build.

anyone can make a small tutorial maybe?
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 10th Apr 2008 15:55 Edited at: 10th Apr 2008 16:02
Find out where GDK calls the Windows function RegisterClass. That function uses a structure called WNDCLASS. In that structure is a member called hIcon. That is the handle of the icon for the application. You can use LoadIcon to load it. You do not need to make a resource file to do this, but you must keep the icon file in the application directory in that case.

If that does not suit you, you can load it as a resource after doing this:

You can make resource files with VS2008, you just don't have a Visual editor, or any of the really cool tools that come with it. Resource files are text.

resource.h


appname.rc


You will have to include resource.h and appname.rc in the project by adding them using Solution Explorer.

You will need to add #include "resource.h" in the main source file, too. You can add any type of resource in this manner, including dialog templates, and menus.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 11th Apr 2008 14:53
great one jinzai, well done, works beautifully!

i am sure this will be of great help to all those who want to achive some good results but are just starting out in c++ and don't yet understand how everything works.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 11th Apr 2008 15:02
so the next question would be...

what resources does one have to set/include to have program version, vendor name, etc into in the icon info?!!!

Login to post a reply

Server time is: 2024-05-24 02:26:12
Your offset time is: 2024-05-24 02:26:12