Duplication of TEXTINCLUDE sections in .rc file
Asked Answered
D

2

6

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
Dmso answered 9/8, 2012 at 8:9 Comment(0)
I
9

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
Isogamete answered 9/8, 2012 at 18:40 Comment(0)
D
1

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

Dark answered 9/8, 2012 at 17:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.