Public Group

# Help making blank resource files in VC++ 6.0

This topic is 5071 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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
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


...?

##### Share on other sites
Do you guys ever reply?

##### Share on other sites
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.

##### Share on other sites
Visual studio always mangles resource files. One of the many reasons I use dev-C++.

##### Share on other sites
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.

##### Share on other sites
"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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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?

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
18

• 11
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631420
• Total Posts
2999990
×