Add an icon the the exe-file in Visual C++
Hi,
I would like some help on how to add an icon to my exe-file in Visual C++. I´ve heard that I have to include it in the resources options, but I have no idea on how to do this.
Thanks for any help.
After opening your project, go to New->Files->Resource Script. Give it a name, location for the file, and make sure Add to Project is checked. Now, on the left side (or where ever you placed the workspace window). You should see a ResourceView tab (at the bottom most likely). Click on that. Right click on the upper most folder, and select Import. Select the file of the icon you''d like to add to your project and hit ok. Now, you can rename and edit the icon from the ___ Resources\Icon folder in the ResourceView.
For more information, tell use specifically what you want to do with the icon.
![Resist Windows XP''s Invasive Production Activation Technology!](http://druidgames.warfactory.com/Out_Source/resist.jpg)
http://druidgames.cjb.net/ (If my website isn''t down, it''s a miracle!)
For more information, tell use specifically what you want to do with the icon.
![Resist Windows XP''s Invasive Production Activation Technology!](http://druidgames.warfactory.com/Out_Source/resist.jpg)
http://druidgames.cjb.net/ (If my website isn''t down, it''s a miracle!)
OK, thanks.
Now I want the compiled .exe-file from this project to use the icon i put in resources instead of the default blue-white windows exe icon.
How do I do this?
Now I want the compiled .exe-file from this project to use the icon i put in resources instead of the default blue-white windows exe icon.
How do I do this?
In a Win32 Application you can do one of two things. One is to have them in the Window''s class when you create it:
Or to send two messages telling it to change its icons:
![Resist Windows XP''s Invasive Production Activation Technology!](http://druidgames.warfactory.com/Out_Source/resist.jpg)
http://druidgames.cjb.net/ (If my website isn''t down, it''s a miracle!)
|
Or to send two messages telling it to change its icons:
|
![Resist Windows XP''s Invasive Production Activation Technology!](http://druidgames.warfactory.com/Out_Source/resist.jpg)
http://druidgames.cjb.net/ (If my website isn''t down, it''s a miracle!)
Thanks for the help Null and void.
But could you (or someone else) be a little more indepht in how to do this. Which files do I need to include and what more code do I need?
It would be great if you could write all the code needed and where to put it (in the "main" class?).
Thanks.
But could you (or someone else) be a little more indepht in how to do this. Which files do I need to include and what more code do I need?
It would be great if you could write all the code needed and where to put it (in the "main" class?).
Thanks.
That''s code that should fit right in with any project using the Win32 API. You aren''t doing a Console application, are you?
![Resist Windows XP''s Invasive Production Activation Technology!](http://druidgames.warfactory.com/Out_Source/resist.jpg)
http://druidgames.cjb.net/ (If my website isn''t down, it''s a miracle!)
![Resist Windows XP''s Invasive Production Activation Technology!](http://druidgames.warfactory.com/Out_Source/resist.jpg)
http://druidgames.cjb.net/ (If my website isn''t down, it''s a miracle!)
No, it´s not a console app.
I used your code (both examples) and got these errors:
wcl'' : missing storage-class or type specifiers
wcl'' : redefinition
''hwnd'' : undeclared identifier
''hIcon'' : undeclared identifier
''SendMessageA'' : missing storage-class or type specifiers
too many initializers (on sendmessage)
and so on...
What´s wrong..?
I used your code (both examples) and got these errors:
wcl'' : missing storage-class or type specifiers
wcl'' : redefinition
''hwnd'' : undeclared identifier
''hIcon'' : undeclared identifier
''SendMessageA'' : missing storage-class or type specifiers
too many initializers (on sendmessage)
and so on...
What´s wrong..?
Firstly, is your app a "Win32 Application" or an MFC-based app? If it''s MFC, you''ll do things slightly differently.
The given code was not intended to be used literally, nor were you to use both snippets; they are both different and separate methods of accomplishing the same thing.
The first method is to set the icon when you register your window class and create your window.
The second method...well, I would just use the first method.
If you need more info, let me know.
The given code was not intended to be used literally, nor were you to use both snippets; they are both different and separate methods of accomplishing the same thing.
The first method is to set the icon when you register your window class and create your window.
wcl
is the WNDCLASS
structure you have to fill in order to register a window class for your main window. The second method...well, I would just use the first method.
If you need more info, let me know.
Thanks, I got it now.
Only one problem remaining, how do I declare the icon name?
I get the error "''MY_ICON_NAME'' : undeclared identifier".
Thanks!
Only one problem remaining, how do I declare the icon name?
I get the error "''MY_ICON_NAME'' : undeclared identifier".
Thanks!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement