如何在c+&#x2B中删除_t()的硬编码值

发布于 2025-01-24 09:18:33 字数 318 浏览 2 评论 0原文

CAToolbar* pToolBarCommunicate = (CAToolbar*)pCommandBars->Add(new CAToolbar, _T("Comman Toolbar"), xtpBarTop);

我有这个代码,其中“通用工具栏”是硬编码的,我需要将其更改为.rc文件中提到的某些ID,我应该直接删除文本并用该文本中提到的.rc文件中提到的ID替换。 - > add(new catoolbar,_t(ids_comman_toolbar),xtpbartop); 这是正确的方法吗?还是有更好的方法?

CAToolbar* pToolBarCommunicate = (CAToolbar*)pCommandBars->Add(new CAToolbar, _T("Comman Toolbar"), xtpBarTop);

I have this piece of code where the 'Common Toolbar' is hardcoded, I need to change it to some IDS mentioned in .rc file, shall I directly remove the text and replace with ID which is mentioned in .rc file with this text. something like ->Add(new CAToolbar, _T(IDS_COMMAN_TOOLBAR), xtpBarTop);
is it correct way of doing this ? or is there any better way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉酒的小男人 2025-01-31 09:18:33

您可以使用makeIntresource

CAToolbar* pToolBarCommunicate = (CAToolbar*)pCommandBars->Add(
                        new CAToolbar, 
                        MAKEINTRESOURCE(IDS_COMMAN_TOOLBAR), 
                        xtpBarTop);

您可以在此处查看更多信息: makeIntresourcea acro(hinuser.h)

You can use MAKEINTRESOURCE:

CAToolbar* pToolBarCommunicate = (CAToolbar*)pCommandBars->Add(
                        new CAToolbar, 
                        MAKEINTRESOURCE(IDS_COMMAN_TOOLBAR), 
                        xtpBarTop);

You can see more about it here: MAKEINTRESOURCEA macro (winuser.h)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文