MFC resource.h command/message IDs

前端 未结 3 1984
孤独总比滥情好
孤独总比滥情好 2021-01-13 09:05

I\'m working on an MFC application, that got pretty messy over years and over different teams of developers. The resource.h file, which contains all command/message mappings

3条回答
  •  执念已碎
    2021-01-13 09:45

    You are mixing two things:

    1. Message IDs. These must be larger than WM_USER. Message IDs are not defined in resource.h. It seems from your description that you are not using application private messages.
    2. Command IDs. Your application itself must not have duplicate command IDs. The command ID values should also not interfere with the standard MFC IDs defined in afxres.h. Theses command IDs start at 0xE100, so it is unlikely that the values in resource.h. The resource compiler will generate an error for duplicate IDs in you rc file

    There is probably no need for you to edit resource.h manually.

    I would recommend to use the "Resource symbols" tool (right click on the resources in resource view and choose from the popup menu, I assume you are using VC++), to remove all the unused IDs from resource.h.

提交回复
热议问题