Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: brew on July 18, 2007, 04:11 PM

Title: Resources
Post by: brew on July 18, 2007, 04:11 PM
Okay, how do I use a resources from a resource file? (especially icons) It seems no matter what I do, it just doesn't work. I've made the resource.h file, (named specifically that), and defined the resources like this:

#define IDI_ICON 1001
#define IDI_ICONSMALL 1002

where the constant's names match the names of the resources within the resource file.
Then i included that .h file in my other file, and when registering the window class just used those names for the icons. (IDI_ICON, IDI_ICONSMALL, etc) You'd think that would work right? Well it DOESNT. I'm so frustruated right now, can anyone help me? Also it's now giving me some gay error that there's an "unexpected end of the file" for my .rc file. This is just total bullshit, I feel like MS is doing this to me (and maybe other people) on purpose. I've even checked the example hello world window that is included with VC++ and it does nothing different. This is completely pissing me off, (about how it doesnt work for just me) and I don't get what i'm doing wrong. can anyone help??
Title: Re: Resources
Post by: l2k-Shadow on July 18, 2007, 05:46 PM
Can you post the link to your project?

the unexpected end of file is probably you not including the precompiled header file (stdafx.h). you can turn mandatory including of that file in your VC++ project settings. the unrecognizing of the constants might be due to the unexpected end of file error as well.
Title: Re: Resources
Post by: brew on July 18, 2007, 07:55 PM
Ah nevermind my problem was that i didn't know VC++ makes a resource.h file by itself, and i made one (which overwrote it) and apparently the .rc file reads something from the resource.h file? that would make it give the error. Anyways I figured out what i'm doing wrong, but not quite. When I use the constants in resource.h (created automatically btw) it makes a question mark icon instead of what i want (the one i included as an icon....) I don't think stdafx.h has anything to do with it by the way (i started from a blank project and just never included it). This is complete bullshit, I'm getting tired of struggling with some gay icon. :l
Title: Re: Resources
Post by: Yegg on July 18, 2007, 10:03 PM
Don't give up on that icon, it's actually quite easy once you get the hang of it.

Question: Why not get into .NET?
Title: Re: Resources
Post by: brew on July 18, 2007, 10:39 PM
Quote from: Yegg on July 18, 2007, 10:03 PM
Question: Why not get into .NET?
I had a bad childhood experience with .NET
and it's slow

I think I got the icon, I made it a numerical resource name and that (kinda) worked, it shows up in the tray icon and the taskbar icon, but it just doesn't show up on the application bar of the window for some reason also winsock2.h is giving me a bunch of crap, it says i have 58 errors and 11 warnings, and without defining it, it says two functions are undeclared identifiers (even though i think it's included in windows.h) god help me .... :(
Title: Re: Resources
Post by: Yegg on July 18, 2007, 11:26 PM
.NET isn't that slow. Besides, software should be concerned more with productivity as opposed to raw speed. Unless you're developing some kind of high performance interpreter, some compiler, or another software which should have absolute speed, which I know you aren't, productivity should be more important.
Title: Re: Resources
Post by: l2k-Shadow on July 19, 2007, 12:33 AM
Quote from: brew on July 18, 2007, 10:39 PM
I think I got the icon, I made it a numerical resource name and that (kinda) worked, it shows up in the tray icon and the taskbar icon, but it just doesn't show up on the application bar of the window for some reason also winsock2.h is giving me a bunch of crap, it says i have 58 errors and 11 warnings, and without defining it, it says two functions are undeclared identifiers (even though i think it's included in windows.h) god help me .... :(

lol man seriously try searching some tuts before attempting to code something like winsock.

include WS2_32.lib in your project.
Title: Re: Resources
Post by: brew on July 19, 2007, 09:27 AM
Quote from: l2k-Shadow on July 19, 2007, 12:33 AM
Quote from: brew on July 18, 2007, 10:39 PM
I think I got the icon, I made it a numerical resource name and that (kinda) worked, it shows up in the tray icon and the taskbar icon, but it just doesn't show up on the application bar of the window for some reason also winsock2.h is giving me a bunch of crap, it says i have 58 errors and 11 warnings, and without defining it, it says two functions are undeclared identifiers (even though i think it's included in windows.h) god help me .... :(

lol man seriously try searching some tuts before attempting to code something like winsock.

include WS2_32.lib in your project.

And how would i do that? I tried #pragma comment (lib, "WS2_32.LIB") but it gave me the same thing. As for actually adding it to the source files of your project... i've never heard of anyone having to do that, or even saw anyone doing that for a winsock connection.
Title: Re: Resources
Post by: Yegg on July 19, 2007, 11:25 AM
I haven't used VC++ in ages, but the IDE does have a feature for adding files to the project. Add the WS2_32.lib file to your project. It's no special task; it's very simple.
Title: Re: Resources
Post by: brew on July 19, 2007, 12:55 PM
Quote from: Yegg on July 19, 2007, 11:25 AM
I haven't used VC++ in ages, but the IDE does have a feature for adding files to the project. Add the WS2_32.lib file to your project. It's no special task; it's very simple.

How do I include it in my project? Its obviouly somewhere in the Insert menu item, but where...? in Include text file it doesn't even show .lib files as an option, and the only other things are resources..... not so simple, huh
Title: Re: Resources
Post by: Yegg on July 19, 2007, 02:04 PM
Quote from: brew on July 19, 2007, 12:55 PM
Quote from: Yegg on July 19, 2007, 11:25 AM
I haven't used VC++ in ages, but the IDE does have a feature for adding files to the project. Add the WS2_32.lib file to your project. It's no special task; it's very simple.

How do I include it in my project? Its obviouly somewhere in the Insert menu item, but where...? in Include text file it doesn't even show .lib files as an option, and the only other things are resources..... not so simple, huh

Which software are you using?
Title: Re: Resources
Post by: brew on July 19, 2007, 02:47 PM
visual c++...
Title: Re: Resources
Post by: Yegg on July 19, 2007, 03:23 PM
Quote from: brew on July 19, 2007, 02:47 PM
visual c++...

Way to go fucking genius!? There's more than one version, idiot.

If you're using VC++ 6, then go to Project > Add to Project > Files... and add the WS2_32.lib file.

Title: Re: Resources
Post by: brew on July 19, 2007, 04:01 PM
Quote from: Yegg on July 19, 2007, 03:23 PM
Quote from: brew on July 19, 2007, 02:47 PM
visual c++...

Way to go fucking genius!? There's more than one version, idiot.

If you're using VC++ 6, then go to Project > Add to Project > Files... and add the WS2_32.lib file.



"hyyyy im yegg i wonder what VERSION of visual C++ you're using"

Quote
Which software are you using?

Yes. VC++ 6.
Title: Re: Resources
Post by: Yegg on July 19, 2007, 08:32 PM
Quote from: brew on July 19, 2007, 04:01 PM

"hyyyy im yegg i wonder what VERSION of visual C++ you're using"

Quote
Which software are you using?

Yes. VC++ 6.

What does that even mean? What version am I using? I don't use VC++. I mentioned that I haven't used it in ages. Earlier when I didn't specify it was because I didn't have to. I don't use any VC++ and both of them have that same feature. Therefore, my statement was completely correct. You couldn't figure out how to add the file so I asked which version you used, apparently you didn't know they had a version judging by your response... It's a few extremely simple steps that you considered "not so simple".
Title: Re: Resources
Post by: brew on July 19, 2007, 09:08 PM
Quote from: Yegg on July 19, 2007, 08:32 PM
Quote from: brew on July 19, 2007, 04:01 PM

"hyyyy im yegg i wonder what VERSION of visual C++ you're using"

Quote
Which software are you using?

Yes. VC++ 6.

What does that even mean? What version am I using? I don't use VC++. I mentioned that I haven't used it in ages. Earlier when I didn't specify it was because I didn't have to. I don't use any VC++ and both of them have that same feature. Therefore, my statement was completely correct. You couldn't figure out how to add the file so I asked which version you used, apparently you didn't know they had a version judging by your response... It's a few extremely simple steps that you considered "not so simple".

I ment to say that you asked what "software" i am using, well uh, that'd be MSVC++. What you should have said is what version I am using... you flipped out about something simple like that. Wow you get raged way too quick. By the way, adding WS2_32.lib didn't help at all.
Title: Re: Resources
Post by: Yegg on July 19, 2007, 09:59 PM
Quote from: brew on July 19, 2007, 09:08 PM

I ment to say that you asked what "software" i am using, well uh, that'd be MSVC++. What you should have said is what version I am using... you flipped out about something simple like that. Wow you get raged way too quick. By the way, adding WS2_32.lib didn't help at all.

No. I'm not "raged". I'm annoyed that you can't seem to figure out something so simple (ie. me asking which software you were using). When someone asks you which software you were using, specify the exact version (there are differences between versions). VC++ 6 and 7 and 8 are all different. Adding WS2_32.lib does help. You clearly did something else incorrect as well.
Title: Re: Resources
Post by: warz on July 20, 2007, 12:44 AM
one thing i have failed to see in this entire thread is some code. how are we supposed to help without code snippets? it sounds like you're including everything required, so it's a code issue. also, if you feel like it's "just you" experiencing an issue, that's probably a sign that it isn't C++'s fault, or whoever you blamed in your first post - it's probably you doing something wrong. (which we all probably assume when reading a post by you, anyways)
Title: Re: Resources
Post by: brew on July 21, 2007, 12:06 PM
Quote from: betawarz on July 20, 2007, 12:44 AM
one thing i have failed to see in this entire thread is some code. how are we supposed to help without code snippets? it sounds like you're including everything required, so it's a code issue. also, if you feel like it's "just you" experiencing an issue, that's probably a sign that it isn't C++'s fault, or whoever you blamed in your first post - it's probably you doing something wrong. (which we all probably assume when reading a post by you, anyways)

Warz, if you had read the entire topic you would have realized I got the icon (partially) working ages ago. I also found a solution to my winsock problem -- don't use winsock 2.2.
Title: Re: Resources
Post by: Yegg on July 21, 2007, 03:04 PM
Quote from: brew on July 21, 2007, 12:06 PM
Quote from: betawarz on July 20, 2007, 12:44 AM
one thing i have failed to see in this entire thread is some code. how are we supposed to help without code snippets? it sounds like you're including everything required, so it's a code issue. also, if you feel like it's "just you" experiencing an issue, that's probably a sign that it isn't C++'s fault, or whoever you blamed in your first post - it's probably you doing something wrong. (which we all probably assume when reading a post by you, anyways)

Warz, if you had read the entire topic you would have realized I got the icon (partially) working ages ago. I also found a solution to my winsock problem -- don't use winsock 2.2.

...How does that even relate to what warz said?

How is that a solution by not using Winsock 2.2?
Title: Re: Resources
Post by: brew on July 21, 2007, 04:14 PM
Quote from: Yegg on July 21, 2007, 03:04 PM
Quote from: brew on July 21, 2007, 12:06 PM
Quote from: betawarz on July 20, 2007, 12:44 AM
one thing i have failed to see in this entire thread is some code. how are we supposed to help without code snippets? it sounds like you're including everything required, so it's a code issue. also, if you feel like it's "just you" experiencing an issue, that's probably a sign that it isn't C++'s fault, or whoever you blamed in your first post - it's probably you doing something wrong. (which we all probably assume when reading a post by you, anyways)

Warz, if you had read the entire topic you would have realized I got the icon (partially) working ages ago. I also found a solution to my winsock problem -- don't use winsock 2.2.

...How does that even relate to what warz said?

How is that a solution by not using Winsock 2.2?

Warz was talking about my problem in the first post, so i told him i got that working, and he was also talking about my winsock2.h problem, and i told him my solution for that. So anotherwords everything's just A-OK, i don't need any help with that anymore.

Its a solution because i'm able to continue on with my application without an error stopping me

I don't get why any of that matters though, yegg?
Title: Re: Resources
Post by: Yegg on July 21, 2007, 08:15 PM
warz said that you failed to show code. He didn't tell how to fix the problem. He said what you should have done in the first place when you needed help.

If you're not using Winsock 2.2, then what are you using?

It matters because you seem to have misunderstood what he said.
Title: Re: Resources
Post by: Explicit on July 22, 2007, 05:41 AM
Quote from: Yegg on July 21, 2007, 08:15 PM
warz said that you failed to show code. He didn't tell how to fix the problem. He said what you should have done in the first place when you needed help.

If you're not using Winsock 2.2, then what are you using?

It matters because you seem to have misunderstood what he said.

Or you're making mountains out of molehills.
Title: Re: Resources
Post by: brew on July 22, 2007, 10:24 AM
Quote from: Yegg on July 21, 2007, 08:15 PM
If you're not using Winsock 2.2, then what are you using?
Winsock 1.1. (0x101 for my requested version in WSAStartup)
Title: Re: Resources
Post by: l2k-Shadow on July 22, 2007, 10:59 AM
i would still look into your code, i use winsock 2.2 and it works just fine. Don't expect your program to work well in the long run just because you fill it with bad workarounds and unstable solutions.