Visual Studio C++ Combo Box Control does not work with Multi-Byte Character Set
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.
"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.
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.
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.
精彩评论