VS资源(基础)

1. 资源Basic

Visual C++ 支持十种资源:加速键、位图、光标、对话框、HTML、图标、菜单、串表、工具条和版本信息。            各种资源就是堆数据而已,最终都会被嵌入到EXE文件里的数据区中。需要的时候就通过函数加载到内存中使用。和数据库一样的。各种资源通过ID来唯一确 定,就像数据库用关键字来确定一样。不同的资源由于类型不一样可以使用等值的ID,如同数据库里的每一个表单里的关键字值不唯一,但不同表单的关键字是允 许一样的。

2. Next ID Issue

RC文件中,都有如下一段宏定义:

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        101
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1001
#define _APS_NEXT_SYMED_VALUE           101
#endif

#endif

这些宏的含义在于为资源编辑器维护下一个resource, command, control and symbol的ID,从而使得在可视化编辑器里编辑、添加任何资源时,ID的分配遵循统一的规则。

Note:

1. When adding a rc file to an empty dll project, VC will generate a filename.rc file and two files automatically: resource.h and filename.aps.

2. Even direclty adding string table items by editor, the next resource id is not the next id after current max string ID. It can be easily found by a try.

[摘自:http://msdn.microsoft.com/en-us/library/6t3612sk(VS.80).aspx]

For any given .RC file, Visual C++ incrementally assigns IDs in each of four ID domains. Between editing sessions, Visual C++ keeps track of the last ID it assigned in each of the domains in the symbol header file for the .RC file. Here is what the APS_NEXT values are for an empty (new) .RC file:

#define _APS_NEXT_RESOURCE_VALUE  101

#define _APS_NEXT_COMMAND_VALUE 40001

#define _APS_NEXT_CONTROL_VALUE 1000

#define _APS_NEXT_SYMED_VALUE 101

_APS_NEXT_RESOURCE_VALUE is the next symbol value that will be used for a dialog resource, menu resource, and so on. The valid range for resource symbol values is 1 to 0x6FFF.

_APS_NEXT_COMMAND_VALUE is the next symbol value that will be used for a command identification. The valid range for command symbol values is 0x8000 to 0xDFFF.

_APS_NEXT_CONTROL_VALUE is the next symbol value that will be used for a dialog control. The valid range for dialog control symbol values is 8 to 0xDFFF.

_APS_NEXT_SYMED_VALUE is the next symbol value that will be issued when you manually assign a symbol value using the New command in the Symbol Browser.

原文地址:https://www.cnblogs.com/taoxu0903/p/1435146.html