I have a c++ project compiled in ascii. I am using Ccombox MFC class and trying to set unicode text to it using Addstring() method but it's not working. Is there any way/workaround to set unicode text to Ccomobox?
Asked
Active
Viewed 193 times
0
-
2If you don't compile your program for Unicode (TCHAR=wchar_t), CComboBox won't be using a Unicode window, and won't be able to accept Unicode text. Unless you are running on Windows 10 and have enabled support for UTF-8 to be settable as your program's ACP codepage, then you can use UTF-8 strings for Unicode text. – Remy Lebeau Jan 28 '21 at 06:57
-
What do you mean you are using the `CComboBox` class? Are you creating the control programmatically? Or it is a resource script? It is possible to create Unicode controls in a MBCS application, using the wide versions of functions or classes. Also check the `CCM_SETUNICODEFORMAT` message and add strings using `CB_ADDSTRING`. Since a combo actually consists of two sub-controls, you may have to send the `CCM_SETUNICODEFORMAT` message to both of them. Not sure if it will work, it does work for list-view and tree-view controls though (using `LVM_SETUNICODEFORMAT/TVM_SETUNICODEFORMAT). – Constantine Georgiou Jan 28 '21 at 20:25