Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplication of TEXTINCLUDE sections in .rc file

In my .rc file I found that I have the 3 TEXTINCLUDE sections repeated twice, with different content. When I open "Resource Includes", only the includes from the first 3 sections are shown. I've tweaked the .rc a long time ago, so it maybe is a leftover from that.

Can I safely remove the second 3 sections?

I've pasted this from my .rc file, you can see how the TEXTINCLUDE sections are repeated (i.e. "3 TEXTINCLUDE" is followed by "1 TEXTINCLUDE".

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#include ""afxres.h""\r\n"
    "#include ""res/Pngs.h""\r\n"
    "#include ""res/PngsNag.h""\0"
END

3 TEXTINCLUDE 
BEGIN
    "#include ""afxres.rc""      // Standard components\r\n"
    "#include ""res/MyProject.rc2""\r\n"
    "#include ""res/Pngs.rc2""\r\n"
    "#include ""res/PngsNag.rc2""\0"
END

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

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

3 TEXTINCLUDE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif //_WIN32\r\n"
    "#include ""res\\MyProject.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""         // Standard components\r\n"
    "#endif\r\n"
    "\0"
END
like image 442
sashoalm Avatar asked Aug 09 '12 08:08

sashoalm


2 Answers

This is gunk that's generated by the graphical resource editor built into Visual Studio. It doesn't have any effect at runtime, it merely saves state for the editor. You'll run a serious risk of breaking the editor when you mess with it. Which is okay if you never use the resource editor and always manage resources with a text editor.

There's a bit of background info in this MSDN article:

The following describes how Visual C++ maintains this information in a .RC file. You do not need this information to use Visual C++, but it may enhance your understanding so that you can more confidently use the Set Includes feature.

Each of the above three types of Set Includes information is stored in the .RC file in two forms: (1) as #include or other directives interpretable by the Resource Compiler, and (2) as special TEXTINCLUDE resources interpretable only by Visual C++.

The purpose of the TEXTINCLUDE resource is to safely store Set Include information in a form that is readily presentable in Visual C++'s Set Includes dialog box. TEXTINCLUDE is a resource type defined by Visual C++. Visual C++ recognizes three specific TEXTINCLUDE resources that have the resource identification numbers 1, 2 and 3:

TEXTINCLUDE resource ID     Type of Set Includes information
        1                   Symbol Header File
        2                   Read-Only Symbol Directives
        3                   Compile-Time Directives
like image 95
Hans Passant Avatar answered Oct 03 '22 02:10

Hans Passant


Only one set of TEXTINCLUDE's is needed. You just need to decide what set works better for you.

like image 39
Kirill Kobelev Avatar answered Oct 03 '22 01:10

Kirill Kobelev