Link to home
Start Free TrialLog in
Avatar of myson
myson

asked on

Unicode and List View common control

Hello!
I've got a Win32API nonMFC C++ program, which is compiled with UNICODE directive. Program is run under Win2000. I have in that application a dialog box with a List View control. When I ask IsWindowUnicode(), it replies with TRUE. I add an item to it with some non-ascii and non-local codepage characters in widechar string. I ask for the text and i compare it char by char and it is the same. But list view displays instead of those chars an thick vertical line. When I create a file named exactly like that string, Windows Explorer displays those chars OK. How can I make my list view to properly display non-ascii and non-local codepage characters?

Thanks in advance,
MyS
Avatar of Axter
Axter
Flag of United States of America image

Can you show the code you're using to add the text to the listview?
Avatar of myson
myson

ASKER

listitem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
listitem.iItem = iIndex;
listitem.iSubItem = 0;
listitem.pszText = LPSTR_TEXTCALLBACK;
listitem.iImage = 0;
listitem.lParam  = (LPARAM) pItemData;
if(ListView_InsertItem(hwndList, &listitem) == -1)
    return FALSE;

Callback notification:

case LVN_GETDISPINFO:                    
     LV_DISPINFO pnmv = (LV_DISPINFO *) lParam;
     if (pnmv->item.mask & LVIF_TEXT)
     {
       ITEMDATA * pItem = (ITEMDATA *) pnmv->item.lParam;
       switch (pnmv->item.iSubItem)
       {
        case 0:
     lstrcpyn(pnmv->item.pszText, pItem->szItemName, pnmv->item.cchTextMax);

       .....

I hope pretty standard. But I don't think the problem is in this.
ASKER CERTIFIED SOLUTION
Avatar of NickRepin
NickRepin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of myson

ASKER

Hmm, yeah. This is what I have wanted. Thanks.