从资源文件生成快捷方式列表(由包含 & 符号的按钮标题表示)
我有一个包含 429 个 MFC 资源文件的列表,我必须为其生成快捷方式列表,其中包含与符号的按钮(例如按钮“&Close”),指示 ALT-C 是关闭该特定对话框的快捷方式。
问题是资源文件包含许多不同格式的对话框:
IDD_VIDEO DIALOG 0, 0, 471, 187
...
BEGIN
...
PUSHBUTTON "&Close",IDC_CLOSE,89,166,53,14
...
END
我想要提取的格式将是“&Close”(或理想情况下“ALT-C &Close”)和其他带有快捷方式的标签的列表,按它们所在的对话框进行分区(例如 IDD_VIDEO)。正则表达式似乎是最好的解决方案,但我还没有找到一个有效的正则表达式。
I have a list of 429 MFC resource files that I have to generate a list of shortcuts for, which would be buttons containing an ampersand symbol (e.g. BUTTON "&Close") indicating that ALT-C is the shortcut for closing that particular dialog.
The problem is that the resource files contain many different dialogs formatted as such:
IDD_VIDEO DIALOG 0, 0, 471, 187
...
BEGIN
...
PUSHBUTTON "&Close",IDC_CLOSE,89,166,53,14
...
END
The format I would like to pull out would be a list of "&Close" (Or ideally "ALT-C &Close") and other labels with shortcuts, sectioned by which dialog they're under (e.g. IDD_VIDEO). Regex seems like the best solution but I haven't been able to figure a working regex out for this yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢您添加的规格。这应该有效:
这将匹配从
IDD_whatever
到下一个END
的整个部分。然后,您需要获取该字符串并对其应用以下正则表达式:这是一个 C# 示例:
当然,此代码片段不会对
identifier
和altCString
执行任何操作,但是我想你明白了。Thanks for the added specifications. This should work:
This will match the entire section from
IDD_whatever
until the nextEND
. Then you need to take that string and apply the following regex to it:Here's a C# example:
Of course this code snippet doesn't do anything with
identifier
andaltCString
, but I think you get the idea.