编辑 rc 文件,然后在 VC 对话框向导中打开它时,由于 TBS_NOTIFYBEFOREMOVE 出现错误 RC2104

2022-01-24 00:00:00 slider windows-7 c++ mfc visual-studio-2010

我有一个基于 VC++/MFC 对话框的项目.在这些对话框中,我使用了一些移动前通知"为 true 的滑块.有时,我更喜欢在文本编辑器中手动编辑相关的 .rc 文件,而不是使用 VS 对话框向导来编辑它们.

I have a VC++/MFC dialog-based project. In those dialogs, I'm using some sliders with "Notify Before Move" at true. Sometimes, instead of using VS dialog wizard to edit them, I prefer to edit the related .rc file manually in a text editor.

问题是,在编辑 .rc 文件后,当我尝试再次在 VS 向导中打开对话框时,我收到此错误:错误 RC2104:未定义的关键字或键名:TBS_NOTIFYBEFOREMOVE"我仍然可以成功编译项目,但我无法再使用 VS 向导打开项目资源.解决方法是手动删除关键字,然后我可以使用向导重新打开资源,但我必须将每个滑块移动前通知"设置再次设置为 true...

The issue is, after editing the .rc file, when I'm trying to open a dialog in VS wizard again, I get this error: "error RC2104: undefined keyword or key name: TBS_NOTIFYBEFOREMOVE" I can still compile the project successfully, but I cannot open the project resources with VS wizard anymore. The workaround is to remove manually the keyword, then I can re-open resources with the wizard, but I have to set every slider "Notify Before Move" setting at true again...

尽管项目仍然可以正常编译,但我不明白为什么会出现此错误.如果可能的话,我想避免错误并且每次都必须通过这个解决方法.有谁知道如何避免这个错误?

I don't understand why I get this error despite the project still compiling fine. If possible, I want to avoid the error and having to go through this workaround each time. Does anybody know how to avoid this error?

推荐答案

这是因为您选择的 _WIN32_WINNT 宏的值.TBS_NOTIFYBEFOREMOVE 样式标志仅在更高版本的 Windows 中可用.您必须至少选择 0x501.或者换句话说,您的程序将无法在 Windows 2000(版本 0x500)或更早版本上运行.现在这不是什么大问题,所以提高价值.

This happens because of the value for the _WIN32_WINNT macro you selected. The TBS_NOTIFYBEFOREMOVE style flag is only available in later versions of Windows. You must select at least 0x501. Or in other words, your program won't be able to run on Windows 2000 (version 0x500) or earlier. That's not much of a problem these days so bump up the value.

相关文章