c++ - .rc 文件中的 TEXTINCLUDE 部分重复

标签 c++ visual-studio winapi resource-file

在我的 .rc 文件中,我发现 3 个 TEXTINCLUDE 部分重复了两次,但内容不同。当我打开“资源包含”时,只显示前 3 个部分的包含。我很久以前就对 .rc 进行了调整,所以它可能是那个的遗留物。

我可以安全地删除后 3 个部分吗?

我从我的 .rc 文件中粘贴了这个,您可以看到 TEXTINCLUDE 部分是如何重复的(即“3 TEXTINCLUDE”后面跟着“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

最佳答案

这是由 Visual Studio 中内置的图形资源编辑器生成的垃圾。它在运行时没有任何效果,它只是为编辑器保存状态。当你弄乱它时,你会冒着破坏编辑器的严重风险。如果您从不使用资源编辑器并始终使用文本编辑器管理资源,那也没关系。

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

关于c++ - .rc 文件中的 TEXTINCLUDE 部分重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11879194/

相关文章:

c++ - 程序在 C++ 中提前结束

c++ - 我如何让 visual studio 2008 为我的 MFC 对话框资源创建一个类?

c++ - 特定长度的字符串的散列

c++ - 无法打印 signed int 类型的大小

visual-studio - Visual Studio 2015丢失设置

python - 如何在 Visual Studio 中使用 python 设置相对路径?

visual-studio - F6 编译?

c++ - 如何在选项卡控件页面内显示对话框?

c - 下面的场景如何同步?

C++ Winapi waveOutSetVolume()