Windows dialogue in visual studio causing errors

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

Recommended Posts

I've got a simple menu written by hand and it works fine. However, I now need to create a dialogue with IP address controls and as such I need to use Visual studio 2003's resource editor. However, the moment I edit & save my .rc file using VS, it causes errors. I'm talking about literally just opening the working file, saving it using the resource editor, then compiling (I'm not even trying to add my new dialogue, merely ensure that the original menu will compile properly). Original code:
#include "CLIENT_RES.H"
{
POPUP "&File"
{
}

POPUP "&Connect"
{
}

POPUP "&Help"
{
}

}


Here's what VS generates when I re-save it:
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "client_res.h"

/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
//

BEGIN
POPUP "&File"
BEGIN
END
POPUP "&Connect"
BEGIN
END
POPUP "&Help"
BEGIN
END
END

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""client_res.h""\r\n"
"\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif    // APSTUDIO_INVOKED

#endif    // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////

#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED


Here's the list of errors it generates when attempting to compile:
Compiling resources...
.\client_res.rc(20) : error RC2144 : PRIMARY LANGUAGE ID not a number
.\client_res.rc(37) : error RC2164 : unexpected value in RCDATA
.\client_res.rc(42) : error RC2164 : unexpected value in RCDATA

...
Client - 10 error(s), 0 warning(s)


I also tried remaking the menu from scratch using the resource editor, but the same thing happens. I've googled various error codes and checked MSDN to no avail; I don't understand what's going on. Any idea what the hell is going on and, more to the point, does anyone know why the resource editor adds so much redundant rubbish to my files? :( Any help much appreciated.

Share on other sites
yeah, the resource editor always adds a ton of rubbish, mainly for language support, which isn't needed unless you're on an english machine programming an app meant for some other language. it even adds more rubbish for an MFC app. i think there's a missing #endif in that code you posted though.... i really don't use the if !defined preprocessor syntax, but i think it requires and #endif, which i don't see one for it.

what i typically do if i have to use the resource editor is i save a copy of my handmade RC file. i then load the copy into the resource editor and add my dialogs and controls to it. then i open the copy in notepad and copy and paste the DIALOGEX resource into my original. there will be some missing identifiers... i just add these manually to my own resource header (in your case CLIENT_RES.H). i also clean up any syntax or spacing i don't like (like replacing BEGIN and END with {} and so on).

Share on other sites
I ended up giving up and just rebuilding it using the resource editor. It must not like trying to build off an existing .rc file of a different format.