Commit cb84de98 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Make GetWindowInfo() work for all windows and return correct values.

parent 511577da
......@@ -3238,42 +3238,28 @@ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPSTR lpszFileName, UINT cchFil
*/
BOOL WINAPI GetWindowInfo( HWND hwnd, PWINDOWINFO pwi)
{
WND *wndInfo = NULL;
if (!pwi) return FALSE;
if (pwi->cbSize != sizeof(WINDOWINFO))
{
FIXME("windowinfo->cbSize != sizeof(WINDOWINFO). Please report\n");
return FALSE;
}
wndInfo = WIN_GetPtr(hwnd);
if (!wndInfo) return FALSE;
if (wndInfo == WND_OTHER_PROCESS)
{
FIXME("window belong to other process\n");
return FALSE;
}
if (!IsWindow(hwnd)) return FALSE;
GetWindowRect(hwnd, &pwi->rcWindow);
GetClientRect(hwnd, &pwi->rcClient);
/* translate to screen coordinates */
MapWindowPoints(hwnd, 0, (LPPOINT)&pwi->rcClient, 2);
pwi->rcWindow = wndInfo->rectWindow;
pwi->rcClient = wndInfo->rectClient;
pwi->dwStyle = wndInfo->dwStyle;
pwi->dwExStyle = wndInfo->dwExStyle;
pwi->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
pwi->dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
pwi->dwWindowStatus = ((GetActiveWindow() == hwnd) ? WS_ACTIVECAPTION : 0);
/* if active WS_ACTIVECAPTION, else 0 */
pwi->cxWindowBorders = ((wndInfo->dwStyle & WS_BORDER) ?
GetSystemMetrics(SM_CXBORDER) : 0);
pwi->cyWindowBorders = ((wndInfo->dwStyle & WS_BORDER) ?
GetSystemMetrics(SM_CYBORDER) : 0);
/* above two: I'm presuming that borders widths are the same
* for each window - so long as its actually using a border.. */
pwi->atomWindowType = GetClassLongA( hwnd, GCW_ATOM );
pwi->wCreatorVersion = GetVersion();
/* Docs say this should be the version that
* CREATED the window. But eh?.. Isn't that just the
* version we are running.. Unless ofcourse its some wacky
* RPC stuff or something */
WIN_ReleasePtr(wndInfo);
pwi->cxWindowBorders = pwi->rcClient.left - pwi->rcWindow.left;
pwi->cyWindowBorders = pwi->rcWindow.bottom - pwi->rcClient.bottom;
pwi->atomWindowType = GetClassLongW( hwnd, GCW_ATOM );
pwi->wCreatorVersion = 0x0400;
return TRUE;
}
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