Hello, I have a problem setting up a listview dialog. All the functions work well except the 'LVM_SETIMAGELIST' message to the dialog window. That's the list creation code:
I have used a static global vars for the image lists, like:Code:llistaImatgesG=ImageList_Create(GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON),ILC_COLOR32|ILC_MASK,1,1); llistaImatgesP=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,1); hIcona=LoadIcon(NULL,MAKEINTRESOURCE(IDI_QUESTION)); ImageList_AddIcon(llistaImatgesG,hIcona); ImageList_AddIcon(llistaImatgesP,hIcona);
now the listview creation isCode:HICON hIcona; static HIMAGELIST llistaImatgesG; static HIMAGELIST llistaImatgesP;
is there on the 'SETIMAGELIST' message where I get a NULL return on both cases, but I'm sure that the image list is right because I can paint it on the WM_PAINT message with:Code:CreateWindowEx(WS_EX_CLIENTEDGE,WC_LISTVIEW,"",WS_CHILD|WS_TABSTOP|WS_VISIBLE|LVS_SHOWSELALWAYS|LVS_NOSORTHEADER|LVS_ICON|LVS_SHAREIMAGELISTS,100,100,200,200,hwnd,(HMENU)LLISTA,hInstance,NULL); vsm=SendMessage(GetDlgItem(hwnd,LLISTA),LVM_SETIMAGELIST,(WPARAM)llistaImatgesG,(LPARAM)LVSIL_NORMAL); if(vsm==(LPARAM)NULL) { MessageBox(hwnd,"Error on SETIMAGELIST","",MB_OK); } vsm=SendMessage(GetDlgItem(hwnd,LLISTA),LVM_SETIMAGELIST,(WPARAM)llistaImatgesP,(LPARAM)LVSIL_SMALL); if(vsm==(LPARAM)NULL) { MessageBox(hwnd,"Error on SETIMAGELIST","",MB_OK); }
so I think that the only problem is on the 'appending' the image list to the listview.Code:case WM_PAINT: { RECT area; GetClientRect(hwnd,&area); hdc=BeginPaint(hwnd,&ps); ImageList_Draw(llistaImatgesG,0,hdc,0,0,ILD_NORMAL); ImageList_Draw(llistaImatgesP,0,hdc,100,0,ILD_NORMAL); EndPaint(hwnd,&ps); } break;
How can I solve that? Or, what I'm doing wrong?
Thank's in advance
Niara



LinkBack URL
About LinkBacks



