Title: Resources
blink182fanmatt - January 4, 2005 06:48 AM (GMT)
I can't for the life of me get my resource to work. I'm using MVC++ and using the WinProg tutorials. I created a resource script and created a menu and icon within it but whenever i put in the below code it just doesn't work. It says stuff like Cannot use 'resource.h' because file doesn't exist. Also when I named my resource script I named it resource.rc, should it be resource.h?
| CODE |
| #include "resource.h" |
C-Man - January 4, 2005 08:24 AM (GMT)
resource.h is meant to be used to define resource id's
#define SOMEBUTTON 101
#define SOMEEDIT 1001
then you can include it in the .rc and .cpp and use them to refer/name resources
blink182fanmatt - January 4, 2005 06:18 PM (GMT)
Yeah but where do I put those because I thought you put those in the resource file and there's no like header file or anything I can include with the resource.
C-Man - January 4, 2005 06:27 PM (GMT)
you can prety much use any C/C++ preprocessor directive in a .RC file
including #include "resource.h" and #define ID_EDIT 101 #ifdef #ifndef #else
#endif ect ect
blink182fanmatt - January 4, 2005 06:32 PM (GMT)
So would I put #include "resource.h in my actual program to like call the resource file? And then in there just somewhere I'd put the defines? I keep getting this error...
Cannot open include file: 'resource.h': No such file or directory
KTC - January 4, 2005 07:08 PM (GMT)
You resource file is .rc or whatever, that includes a header file that define the ID for the various resources u use. Also including the header is the actual .cpp file that refers to any of the resource so that it knows what ID it needs. Compile .cpp & .rc and link the result together.
blink182fanmatt - January 4, 2005 07:27 PM (GMT)
I can't find the resource Header file, all MVC++ has is Resource Symbol Includes, and there is #include "afxres.h" under Read-Only Symbol Directives.
ih8censorship - January 4, 2005 09:59 PM (GMT)
sometimes vc++ is works in a directory that you dident think about. did you search your whole computer for the header? also for starters anyway try hand coding the .rc and .h. also go to project>add to project>files and then add your .rc that way. then i reccomend using some sort of disassembler to check and see if your resources are actually in the exe and that they have the correct id's. resources arent too bad once ya get the hang of it but getting there was a real pain for me.
blink182fanmatt - January 4, 2005 10:59 PM (GMT)
So just making an Icon in the resource called Icon1 and then defining it in the main program wouldn't work? I absolutly need to call the resource? Also if I wanted to create the resource myself without using the Resource Script would I just create a Header file and import it to my program?
KTC - January 4, 2005 11:51 PM (GMT)
If you create the resource inside VC++, then it shld have make a header file that it includes in the project automatically, you just need to include the right file in you cpp file. If you're doing it yourself, you'd need to write the header file yourself as well, and you include (you don't import things in c++ :P) it.
blink182fanmatt - January 5, 2005 06:23 AM (GMT)
Ok I click New...then add a Resource Script File named Resource and it doesn't work when I try to include it in my main program.
blink182fanmatt - January 9, 2005 02:16 AM (GMT)
So you're saying I need to create a Resource Script and then seperatly create a Header file and then import that in? It doesn't just add it's own header file.
fragspaz - January 9, 2005 07:25 AM (GMT)
omgomgomgomgomgomgomgomgomg!!!!!!!!!! A BLINK fan? i think im just about ready to roll over and die... :X:X:X:X:X:X:X:X:X BLINK HAVE NO TALENT! THEY ARE THE SUX0RS, i could play most of Delonges stuff (the guitarist) whgen i was playing at 5-6 months! damn man, you listen to bad music!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111111111111111111oneoenoen!!!onr!!!!!!!11!!!!1111!!111!
Open note pad, then hand code your RC file, then IMPORT your RC file and rc header file, if you dont know how to handcode it, learn from winprog.net...
omg..... omfg roflmao, a fux0rzzz blink fan, lmaolmaolmaolmaoroflmao ofl rofl roflmao!
C-Man - January 9, 2005 11:32 AM (GMT)
Damn it fragspaz this community is not for flaming people who like different
music then you :angry: and further more this topic wasn't even aimed at music
------
Ok so what you can do is Create a .rc script in vc++ then add new dialogs ect to it
save everything then just add this line to your .cpp
#include "resource.h"
KTC - January 9, 2005 03:30 PM (GMT)
fragspaz, WTF was that about?? This community is about being friendly to other people while trying to help each other. If you're not going to do that, then don't say anything!
donprogc++ - January 9, 2005 05:02 PM (GMT)
Fragspaz if you cant say anything good dont say anything at all
C-Man - January 9, 2005 05:34 PM (GMT)
yeah like that saying goes
"if you don't have anything to say about somebody ... erm .. don't say anything
nice at all!"
LOL j/k :D
blink182fanmatt - January 9, 2005 11:25 PM (GMT)
Hopefully this'll be one of the last replies, so a dialog is like the resource header?
blink182fanmatt - January 10, 2005 12:25 AM (GMT)
Ok I have a resource.h file working but I can't add a resource.rc or it overwrites my resource.h header file.
C-Man - January 10, 2005 09:17 AM (GMT)
justr zip everything up , upload somewhere and i'll have a look at it k ? ;)