From ae7a646f8e8cdb73b2386708fa5daed7d22392e2 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Mon, 8 Aug 2005 11:02:54 +0000 Subject: [PATCH] The listbox test shows that the control id must be stored in WPARAM for the WM_DRAWITEM message. Fix the listbox test so CreateWindow() does not fail on Windows. --- dlls/user/listbox.c | 2 +- dlls/user/tests/listbox.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/user/listbox.c b/dlls/user/listbox.c index 1c8fad76405..2631b647e31 100644 --- a/dlls/user/listbox.c +++ b/dlls/user/listbox.c @@ -578,7 +578,7 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect, TRACE("[%p]: drawitem %d (%s) action=%02x state=%02x rect=%ld,%ld-%ld,%ld\n", descr->self, index, item ? debugstr_w(item->str) : "", action, dis.itemState, rect->left, rect->top, rect->right, rect->bottom ); - SendMessageW(descr->owner, WM_DRAWITEM, 0, (LPARAM)&dis); + SendMessageW(descr->owner, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis); } else { diff --git a/dlls/user/tests/listbox.c b/dlls/user/tests/listbox.c index df75bc89f55..8c14a51d4e3 100644 --- a/dlls/user/tests/listbox.c +++ b/dlls/user/tests/listbox.c @@ -47,10 +47,14 @@ static const char * const strings[4] = { static HWND create_listbox (DWORD add_style, HWND parent) { - HWND handle=CreateWindow ("LISTBOX", "TestList", + HWND handle; + int ctl_id=0; + if (parent) + ctl_id=1; + handle=CreateWindow ("LISTBOX", "TestList", (LBS_STANDARD & ~LBS_SORT) | add_style, 0, 0, 100, 100, - parent, (HMENU)1, NULL, 0); + parent, (HMENU)ctl_id, NULL, 0); assert (handle); SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) strings[0]); @@ -212,7 +216,8 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA trace("%p WM_DRAWITEM %08x %08lx\n", hwnd, wparam, lparam); - ok(wparam == 0, "wrong wparam %04x\n", wparam); + ok(wparam == dis->CtlID, "got wParam=%08x instead of %08x\n", + wparam, dis->CtlID); ok(dis->CtlType == ODT_LISTBOX, "wrong CtlType %04x\n", dis->CtlType); GetClientRect(dis->hwndItem, &rc_client);