Visual Studio C++组合框控件不适用于多字节字符集

发布于 2024-10-05 06:03:27 字数 473 浏览 8 评论 0原文

我有一个使用组合框控件的 Visual Studio 2005 C++ MFC 项目。属性类型 = Dropdown。该项目最初采用 UNICODE 格式,并且组合框控件按预期工作。然后,我必须将字符集从 UNICODE 更改为多字节字符集,以便与特殊工程包(National Instruments 的Measurement Studio)中提供的类/库兼容。这样做后,我注意到组合框将不再正常工作(即没有下拉菜单)。为了证实这一发现,我创建了一个几乎是空的项目,其中只有一个对话框,并且上面只有组合框控件。后台没有代码。
如果我在编辑器中“测试对话框”,它会按预期工作。如果我运行该程序(无论是否进行调试),我都会得到上述行为。如果我将字符集更改为 UNICODE,它运行得很好。
顺便说一句,我还注意到,切换到多字节后,原始项目中的一些按钮的外观发生了变化,但我没有测试它们的功能。

组合框控件的功能是否会受到所选字符集影响的已知原因?谢谢。

I have a Visual Studio 2005 C++ MFC project that utilizes a Combo-box control. Property Type = Dropdown. The project was originally in UNICODE and the combo box control worked as expected. I then had to change the character set from UNICODE to Multi-Byte Character Set to be compatible with the classes/libraries available in a special engineering package, Measurement Studio from National Instruments. Upon doing this I noticed that the combo box would no longer work properly (i.e. no drop down menu). To confirm this finding I created a mostly empty project with one dialog and with only the combo box control on it. No code in the background.
If I "Test Dialog" in the editor it works as expected. If I run the program (whether with or without debugging) I get the behavior described above. If I change the character set to UNICODE it runs perfectly fine.
As a side note, I also noticed that the appearances of some of the buttons in my original project changed after switching to Multi-Byte but I did not test their functionality.

Is there a known reason why a combo box control's functionality would be affected by the chosen character set? Thanks.

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

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

发布评论

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

评论(2

忆梦 2024-10-12 06:03:27

我想您正在使用资源编辑器来填充下拉列表,而不是代码?预填充的数据以二进制形式存储在资源文件中,当您将项目类型从 Unicode 更改为多字节时,它不会被转换。尝试从资源中删除所有字符串并重新输入它们。

I presume you're using the resource editor to populate the drop-down, rather than code? That prefilled data is stored in the resource file in binary form, and it won't be converted when you change the type of project from Unicode to Multibyte. Try deleting all of the strings from the resource and re-entering them.

呢古 2024-10-12 06:03:27

我能够通过显式调整资源编辑器中下拉框的大小来解决该问题。我没有意识到必须这样做,因为在我的 UNICODE 版本中,它会自动放大资源编辑器中明确设置的下拉框,以便容纳所有条目。在多字节版本中它不会自动放大。

I was able to resolve the problem by explicitly resizing the drop down box in the resource editor. I did not realize this had to be done because in my UNICODE version it would automatically enlarge the drop down box from what was explicitly set in the resource editor so as to accommodate all the entries. It would not automatically enlarge in the Multibyte version.

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