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

This commit is contained in:
Dmitry Timoshkov 2003-08-05 18:26:28 +00:00 committed by Alexandre Julliard
parent 511577daf5
commit cb84de9851
1 changed files with 12 additions and 26 deletions

View File

@ -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;
pwi->rcWindow = wndInfo->rectWindow;
pwi->rcClient = wndInfo->rectClient;
pwi->dwStyle = wndInfo->dwStyle;
pwi->dwExStyle = wndInfo->dwExStyle;
GetWindowRect(hwnd, &pwi->rcWindow);
GetClientRect(hwnd, &pwi->rcClient);
/* translate to screen coordinates */
MapWindowPoints(hwnd, 0, (LPPOINT)&pwi->rcClient, 2);
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->cxWindowBorders = pwi->rcClient.left - pwi->rcWindow.left;
pwi->cyWindowBorders = pwi->rcWindow.bottom - pwi->rcClient.bottom;
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 */
pwi->atomWindowType = GetClassLongW( hwnd, GCW_ATOM );
pwi->wCreatorVersion = 0x0400;
WIN_ReleasePtr(wndInfo);
return TRUE;
}