Commit ae7a646f authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

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.
parent cdd75bd4
...@@ -578,7 +578,7 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect, ...@@ -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", TRACE("[%p]: drawitem %d (%s) action=%02x state=%02x rect=%ld,%ld-%ld,%ld\n",
descr->self, index, item ? debugstr_w(item->str) : "", action, descr->self, index, item ? debugstr_w(item->str) : "", action,
dis.itemState, rect->left, rect->top, rect->right, rect->bottom ); 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 else
{ {
......
...@@ -47,10 +47,14 @@ static const char * const strings[4] = { ...@@ -47,10 +47,14 @@ static const char * const strings[4] = {
static HWND static HWND
create_listbox (DWORD add_style, HWND parent) 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, (LBS_STANDARD & ~LBS_SORT) | add_style,
0, 0, 100, 100, 0, 0, 100, 100,
parent, (HMENU)1, NULL, 0); parent, (HMENU)ctl_id, NULL, 0);
assert (handle); assert (handle);
SendMessage (handle, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) strings[0]); 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 ...@@ -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); 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); ok(dis->CtlType == ODT_LISTBOX, "wrong CtlType %04x\n", dis->CtlType);
GetClientRect(dis->hwndItem, &rc_client); GetClientRect(dis->hwndItem, &rc_client);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment