开发者

Unicode strings not showing in Win32 ComboBoxEx

I am creating a WC_COMBOBOXEX on Windows Vista and adding strings to it, but they don't show up in the control. The same strings show up fine if I use the old WC_CO开发者_高级运维MBOBOX with CB_ADDSTRING.

I am calling InitCommonControlsEx with ICC_USEREX_CLASSES and creating the comboboxex using CreateWindowEx with style WS_CHILD|WS_CLIPSIBLINGS|CBS_SIMPLE|CBS_SORT|CBS_HASSTRINGS (no extended styles). I am adding the strings using

COMBOBOXEXITEM cbem = {0};
cbem.mask    = CBEIF_TEXT;
cbem.iItem   = -1;
cbem.pszText = L"hello";
SendMessage(hWnd_, CBEM_INSERTITEM, 0, TOLPARAM(&cbem));

The combobox comes up empty but when I move the cursor up and down in the editcontrol/listbox, I see funny block characters sometimes.

Eventually, I want to add it as a CBS_DROPDOWNLIST to a rebar control but I read somewhere that comboboxex works a lot better in there than the old combobox.

Thanks.


From MSDN:

ComboBoxEx controls support only the following ComboBox styles:

CBS_SIMPLE
CBS_DROPDOWN
CBS_DROPDOWNLIST
WS_CHILD

So CBS_SORT and CBS_HASSTRINGS may be messing up the style bits.


Does it help if you send CBEM_SETUNICODEFORMAT?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜