diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index 0c530f76937..b69f892b78b 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -726,7 +726,7 @@ static void CBPaintText( static const WCHAR empty_stringW[] = { 0 }; if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW ); if( lphc->wState & CBF_FOCUSED ) - SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1); + SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, MAXLONG); } else if(!(lphc->wState & CBF_NOREDRAW) && IsWindowVisible( lphc->self )) { diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 64c7967b26e..f391ab9ce06 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -6625,6 +6625,14 @@ static const struct message SetCurSelComboSeq2[] = { 0 } }; +static const struct message SetCurSelComboSeq_edit[] = +{ + { CB_SETCURSEL, sent|wparam|lparam, 0, 0 }, + { WM_SETTEXT, sent|wparam, 0 }, + { EM_SETSEL, sent|wparam|lparam, 0, INT_MAX }, + { 0 } +}; + static const struct message WmKeyDownComboSeq[] = { { WM_KEYDOWN, sent|wparam|lparam, VK_DOWN, 0 }, @@ -6926,6 +6934,14 @@ static void test_combobox_messages(void) log_all_parent_messages--; ok_sequence(SetFocusButtonSeq2, "SetFocus on a Button (2)", TRUE); + SetFocus(combo); + SendMessageA(combo, WM_SETREDRAW, FALSE, 0); + flush_sequence(); + log_all_parent_messages++; + SendMessageA(combo, CB_SETCURSEL, 0, 0); + log_all_parent_messages--; + ok_sequence(SetCurSelComboSeq_edit, "CB_SETCURSEL on a ComboBox with edit control", FALSE); + DestroyWindow(button); DestroyWindow(combo);