indiocolifa
September 14th, 2003, 03:55 AM
I've the following problem developing my new version of Message Cracker Wizard utility (URL is below) while trying to display ownerdrawn bitmaps on a listbox.
I set associated bitmaps with this:
for (int i = 0; i < numMessages; i++)
{
SendDlgItemMessage (hwnd, IDC_MESSAGES, LB_ADDSTRING, 0, (LPARAM)msginfo[i].WM_msg);
// add a bitmap index depending on type
SendDlgItemMessage (hwnd, IDC_MESSAGES, LB_SETITEMDATA, (WPARAM)i, (LPARAM)msginfo[i].fType);
}
where fType is an int telling the message type (and the bitmap type, of course).
The problem is that I get always no bitmap change.
void Cls_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT * lpDrawItem)
{
char szTextBuf[MAX_PATH];
HDC hdcMem;
HGDIOBJ hbmpOld;
HBITMAP hPic;
int x = lpDrawItem->rcItem.left;
int y = lpDrawItem->rcItem.top;
UINT iBitmap;
switch (lpDrawItem->itemAction)
{
case ODA_DRAWENTIRE:
// Draw message bitmap depending on type
switch (lpDrawItem->itemData)
{
case KEYBOARD:
hPic = hbmpKeyboard;
break;
case MOUSE:
hPic = hbmpMouse;
break;
default:
hPic = hbmpMouse;
break;
}
lpDrawItem->ItemData always = 0!!!
why?
thanks!
I set associated bitmaps with this:
for (int i = 0; i < numMessages; i++)
{
SendDlgItemMessage (hwnd, IDC_MESSAGES, LB_ADDSTRING, 0, (LPARAM)msginfo[i].WM_msg);
// add a bitmap index depending on type
SendDlgItemMessage (hwnd, IDC_MESSAGES, LB_SETITEMDATA, (WPARAM)i, (LPARAM)msginfo[i].fType);
}
where fType is an int telling the message type (and the bitmap type, of course).
The problem is that I get always no bitmap change.
void Cls_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT * lpDrawItem)
{
char szTextBuf[MAX_PATH];
HDC hdcMem;
HGDIOBJ hbmpOld;
HBITMAP hPic;
int x = lpDrawItem->rcItem.left;
int y = lpDrawItem->rcItem.top;
UINT iBitmap;
switch (lpDrawItem->itemAction)
{
case ODA_DRAWENTIRE:
// Draw message bitmap depending on type
switch (lpDrawItem->itemData)
{
case KEYBOARD:
hPic = hbmpKeyboard;
break;
case MOUSE:
hPic = hbmpMouse;
break;
default:
hPic = hbmpMouse;
break;
}
lpDrawItem->ItemData always = 0!!!
why?
thanks!