diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 5bfc0aa..89a5b6f 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2260,7 +2260,7 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode, if (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_READONLY) { MessageBeep(MB_ICONERROR); - return 0; /* FIXME really 0 ? */ + return 0x40201; } if (((unsigned)wstr)>=' ' diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 11930ad..4361b37 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -6181,6 +6181,29 @@ static void test_WM_GETDLGCODE(void) DestroyWindow(hwnd); } +static void test_ES_READONLY(void) +{ + HWND hwnd; + UINT ret; + + hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL, + WS_POPUP|ES_MULTILINE|ES_READONLY, + 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL); + ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError()); + + ret = SendMessage(hwnd, WM_CHAR, 'a', MapVirtualKey('a', MAPVK_VK_TO_VSC) | 0x0001); + ok(ret == 0x40201, "WM_CHAR returned %x\n", ret); + + ret = SendMessage(hwnd, WM_KEYDOWN, VK_RETURN, + MapVirtualKey(VK_RETURN, MAPVK_VK_TO_VSC) | 0x0001); + ok(ret == 0, "WM_KEYDOWN returned %x\n", ret); + ret = SendMessage(hwnd, WM_CHAR, VK_RETURN, + MapVirtualKey(VK_RETURN, MAPVK_VK_TO_VSC) | 0x0001); + ok(ret == 0x40201, "WM_CHAR returned %x\n", ret); + + DestroyWindow(hwnd); +} + START_TEST( editor ) { /* Must explicitly LoadLibrary(). The test has no references to functions in @@ -6235,6 +6258,7 @@ START_TEST( editor ) test_auto_yscroll(); test_format_rect(); test_WM_GETDLGCODE(); + test_ES_READONLY(); /* Set the environment variable WINETEST_RICHED20 to keep windows * responsive and open for 30 seconds. This is useful for debugging.