Help making blank resource files in VC++ 6.0

Started by
9 comments, last by Endurion 19 years, 8 months ago
I'm trying to make a blank dialog without the stupid visuals they let you paint on. How do I go about this and do I need to put any #includes in the file? Please give me some simple steps because this is extremely annoying. I don't know if I did this right, but I went to 'new' and clicked on header file, and typed in resource.h. I throw this in here...

#include <windows.h>
#include <afxres.h>


IDD_ABOUT DIALOG DISCARDABLE  0, 0, 239, 66
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "My About Box"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "&OK",IDOK,174,18,50,14
    PUSHBUTTON      "&Cancel",IDCANCEL,174,35,50,14
    GROUPBOX        "About this program...",IDC_STATIC,7,7,225,52
    CTEXT           "An example program showing how to use Dialog Boxes\r\n\r\nby theForger",
                    IDC_STATIC,16,18,144,33
END

And this shows up...

c:\program files\microsoft visual studio\myprojects\win32 api practice\resource.h(5) : error C2146: syntax error : missing ';' before identifier 'DIALOG'
c:\program files\microsoft visual studio\myprojects\win32 api practice\resource.h(5) : error C2501: 'IDD_ABOUT' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\myprojects\win32 api practice\resource.h(5) : fatal error C1004: unexpected end of file found

...?
Advertisement
Do you guys ever reply?
impatience isn't going to get you answers, for one, and for another thing it's the middle of the night where most people that use this forum are, so perhaps you should wait until at least morning before expecting an answer. I'd try google.
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
Visual studio always mangles resource files. One of the many reasons I use dev-C++.
Don't name it .h, name it .rc. Then the resource compiler will take care of it.

Also you might change windows.h to resource.h. And resource.h ought to hold the defines for the IDs of the components. You can't put them in one file together, as your code will need access to the IDs only. The compiler doesn't know what to do with the resource script, hence the separation.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

"resource.h" is just header where there's a series of #defines which define symbols used in the resource script. So everything that should be put into this file is the line "#define IDD_ABOUT 101" or any other number. Everything other you tried to put there should be in some "*.rc" file and one of the first lines in that file have to be inclusion of your resource.h header.
I tried the .rc file but I don't understand what good it is to me because all I can do in it is call visual dialogs when I want to write it in pure code.
That's a feature of the VS IDE. .rc-Files are recognized as resource scripts and thus opened in the resource editor. You can always open them in another text editor besides and edit manually.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Perhaps you cound unload it. Load it into notetpad and stick an error in it.

When you load it /compile it it should say "Error in script" with a button maked "Edit code" once you have clicked this save your projects. As long as you dont close that window you can edit to your hearts contect.

I know this because my copy of VC6 always halts at its OWN code!
So i cant use the flashly editor thing.
Ok, I opened the .rc file in notepad and I'm now able to stick my own resource code into it. It seems to be comiling fine since the .rc file in vC++ has a file of a dialog box now after writing it in in notepad. Is ths all I need to do then? There's no way of editing the .rc file in VC++ but outside of it?

This topic is closed to new replies.

Advertisement