[Dev-C++] [WinAPI]owner drawn listbox
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: tichy <ti...@po...> - 2005-03-11 19:00:05
|
Hi!
Please take look at this:
g_hwndLBSG =3D CreateWindowEx(WS_EX_CLIENTEDGE,WC_LISTBOX, "",
WS_CHILD | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | LBS_NOTIFY |
WS_VSCROLL | LBS_DISABLENOSCROLL,
530, 50, 80, 300,
g_hwndMain, (HMENU)ID_LBSG, g_hinst, NULL);
case ID_butAddSG:
{//list LB with image path is selected, bitmap displayed in =
a
preview control, button AddSG pressed to add bitmap to listbox LBSG
int sel,nItem;
sel=3DSendMessage(g_hwndLB, LB_GETCURSEL,0,0);
ImageList_Add(g_hlstSG, g_bmp, NULL);
ImageList_GetImageInfo(g_hlstSG, 0, &ii);
SendMessage(g_hwndLB, LB_GETTEXT, (WPARAM)sel,
(LPARAM)g_achTemp);
nItem =3D SendMessage(g_hwndLBSG, LB_ADDSTRING, 0,
(LPARAM)g_achTemp);
SendMessage(g_hwndLBSG, LB_SETITEMDATA, nItem, (LPARAM)g_bmp=
/*
ii.hbmImage */);
SendMessage(g_hwndLBSG, LB_SETCURSEL, 0, 0);
}
break;
................................
case WM_DRAWITEM:
{
if ((int)wParam =3D=3D ID_LBSG) {
MessageBox(g_hwndMain,"ID_LBSG", "",MB_OK);
if(lpDis->CtlType=3D=3DNULL)MessageBox(g_hwndMain,"ODT_ NULL!?",
"",MB_OK);
switch (lpDis->itemAction) {
MessageBox(g_hwndMain,"itemAction", "",MB_OK);
case ODA_DRAWENTIRE:
MessageBox(g_hwndMain,"drawentire", "",MB_OK);
...and so on ...
After I get message "ID_LBSG" (what is ok) I get message "ODT_NULL!?" wha=
t
means, that DRAWITEM structure is not filled. WHY? =3D8O
--
Regards,
Andrzej Kry=F1ski
http:\\tichy.fm.interia.pl
---
avast! antywirus: Wychodzace wiadomosc czysta.
Baza sygnatur wirusow (VPS): 0510-1, 2005-03-11
Przetestowano na: 2005-03-11 19:59:55
avast! - Copyright (c) 2000-2004 ALWIL Software.
http://www.avast.com
----------------------------------------------------------------------
Najlepsze MOTO w sieci! >>> http://link.interia.pl/f1862
|