|
-
March 21st, 2009, 03:23 PM
#16
Re: How do I give my program an icon?
I will try that, thank you so much!
But at 1.; Do I have to create a new .cpp file? And then in the solution explorer, I add the .rc file?
Or just create a blank .rc file with notepad and add 3. into it?
I don't use the "project" stuff.
I just use "New File" and then I set it to .cpp and then I start coding.
-
March 21st, 2009, 05:36 PM
#17
Re: How do I give my program an icon?
 Originally Posted by realchamp
Or just create a blank .rc file with notepad and add 3. into it?
Sure you can do that.
A resource file is just a text file with .rc extension.
VC++ 2008 express edition doesn't have a resource editor,
but that doesn't mean you can manage your resources 
in all, you need a total of three files.
1. whatever.cpp
2. whateverName.rc
3. whateverIcon.ico
unless you can follow richard_tominez's answer on how to manually bind the resource file
to the exe file,
your best chance is to let your project manager (or solution manager) to do the job.
I don't use the "project" stuff.
Hehe, you might want to start using it because you will eventually need it. 
For example, NetBeans (another cool IDE) PM checks code file dependancy by refactoring,
something you can definitely appreciate.
-
March 21st, 2009, 07:15 PM
#18
Re: How do I give my program an icon?
Okay... I tryed both ways. The one of them gave me 78 errors. (Using the project).
I tryed the one with compiling, just getting unknown command "windres".
I wanna use the windres.
However with this in my code:
Code:
#define MY_ICON
using namespace std;
int main()
{
MY_ICON ICON "icon.ico";
bool quit = false;
while (! quit)
{
And this in my icon.rc:
Both my icon.ico and .rc are in the same folder as my main .cpp is.
However when I use the 1 you both set, I get errors. Without it, no errors at all. But the ICON didn't work on my program.
Last edited by realchamp; March 21st, 2009 at 07:17 PM.
-
March 21st, 2009, 07:42 PM
#19
Re: How do I give my program an icon?
 Originally Posted by realchamp
Both my icon.ico and .rc are in the same folder as my main .cpp is.
Great, stay on this track. 
this is how the rest of the files might look like
main.cpp
Code:
#include <iostream>
int main()
{
std::cout << "Hello world!" << std::endl;
return 0;
}
myresource.rc
Code:
101 ICON "icon.ico"
Build your project all together.
Let me know how it goes
-
March 21st, 2009, 08:32 PM
#20
Re: How do I give my program an icon?
 Originally Posted by potatoCode
Build your project all together.
What do you exactly mean? Also, when I don't try to add any "icon" stuff, the program doesn't give me errors or so.
Also if you would like to, I can give you TeamViewer 4 access. Then you can see it with your own eyes.
Or we can just chat over MSN or Steam.
Only if you want.
(I hope I didn't break any forum rules there?)
Last edited by realchamp; March 21st, 2009 at 08:34 PM.
-
March 21st, 2009, 09:19 PM
#21
Re: How do I give my program an icon?
I think we can still solve your problem here.
(and for those who might need the same help later on)
you followed everything I told you but it still didn't work?
Hm, that's odd.
What IDE are you using?
-
March 21st, 2009, 09:30 PM
#22
Re: How do I give my program an icon?
Okay, that's fine.
However, I'm not sure what you mean about "IDE?".. I haven't found out of what that is yet. Only guessing.
-
March 22nd, 2009, 05:34 AM
#23
Re: How do I give my program an icon?
windres is one of the utilities of Mingw package.
To compile your .rc file in command-line using cmd shell:
Code:
c:\mingw\bin> windres -i c:\resource.rc -o c:\resource.o
where:
c:\mingw\bin> is the directory where windres is
windres is the program itself
c:\resource.rc is the input file in C:\ directory
c:\resource.o is the outpuit file in C:\ directory
The commands I gave previously are for MSYS.
-
March 22nd, 2009, 05:46 AM
#24
Re: How do I give my program an icon?
Ohh okay.
Is the folder on my c drive a standard one? (mingw?) Or do I have to DL something?
Okay, I tryed setting it up as you created it. It works. But I don't have any resource.o file.
I ran it in a batch script.
Code:
c:\mingw\bin> windres -i c:\Plugins\srcds\resource.rc -o c:\Plugins\srcds\resource.o
Didn't work. I'm getting invalid directory or no files. Even though my files are in that directory.
(It wouldn't let me save it into c:\srcds.
However I get a new file: windres. But it's a empty and it's only a "file" (none of these .dll, .exe, .bat extensions)
Last edited by realchamp; March 22nd, 2009 at 05:57 AM.
-
March 23rd, 2009, 04:03 AM
#25
Re: How do I give my program an icon?
 Originally Posted by realchamp
However, I'm not sure what you mean about "IDE?".. I haven't found out of what that is yet. Only guessing.
Rather than ask in each your post just use google. The first link does explain it. 
http://www.google.com/search?sourcei...,GGLJ:en&q=ide
Victor Nijegorodov
-
March 23rd, 2009, 07:07 AM
#26
Re: How do I give my program an icon?
 Originally Posted by VictorN
- Sorry.
I just completely forgot about Google :P
Thanks 
ps. Anyone there can help me with this?
-
March 23rd, 2009, 07:11 AM
#27
Re: How do I give my program an icon?
[QUOTE=realchamp;1825171ps. Anyone there can help me with this?[/QUOTE]Help you with what?
What is the current state of your problem?
What IDE (VC++ 6,0, VS2002/2003/2005/2008, ...) are you using?
Victor Nijegorodov
-
March 23rd, 2009, 07:31 AM
#28
Re: How do I give my program an icon?
 Originally Posted by realchamp
Also, when I don't try to add any "icon" stuff, the program doesn't give me errors or so.
You're not... you didn't do anything like change "myicon.gif" to "myicon.ico"... did you?
-
March 23rd, 2009, 08:24 AM
#29
Re: How do I give my program an icon?
 Originally Posted by potatoCode
You're not... you didn't do anything like change "myicon.gif" to "myicon.ico"... did you?
I didn't create the .ico.
I think he compilied it, using a template for Adobe Photoshop.
(#define "he" a freind.)
 Originally Posted by VictorN
Help you with what?
What is the current state of your problem?
What IDE (VC++ 6,0, VS2002/2003/2005/2008, ...) are you using?
I use VC++ 2008 Express Edition.
My current state is that I can't get an icon on my program.
-
March 23rd, 2009, 08:29 AM
#30
Re: How do I give my program an icon?
 Originally Posted by realchamp
I use VC++ 2008 Express Edition.
My current state is that I can't get an icon on my program. 
What have you already tried to do to add an icon?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|