[WIN32SS][USER32] CloseWindow does minimize, doesn't close (#984)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Sat, 27 Oct 2018 11:21:55 +0000 (20:21 +0900)
committerGitHub <noreply@github.com>
Sat, 27 Oct 2018 11:21:55 +0000 (20:21 +0900)
In Windows, user32!CloseWindow minimizes the window. It doesn't close the window actually. This is not a joke. This bad function naming is responsible to MS.

win32ss/user/user32/windows/window.c

index 048673f..bb42e4d 100644 (file)
@@ -127,9 +127,9 @@ ChildWindowFromPointEx(HWND hwndParent,
 BOOL WINAPI
 CloseWindow(HWND hWnd)
 {
-    SendMessageA(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
+    PostMessageW(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
 
-    return HandleToUlong(hWnd);
+    return ValidateHwnd(hWndParent) != NULL;
 }
 
 FORCEINLINE