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) BOOL WINAPI GetWindowInfo( HWND hwnd, PWINDOWINFO pwi)
{ {
WND *wndInfo = NULL;
if (!pwi) return FALSE; if (!pwi) return FALSE;
if (pwi->cbSize != sizeof(WINDOWINFO)) if (pwi->cbSize != sizeof(WINDOWINFO))
{ {
FIXME("windowinfo->cbSize != sizeof(WINDOWINFO). Please report\n"); FIXME("windowinfo->cbSize != sizeof(WINDOWINFO). Please report\n");
return FALSE; return FALSE;
} }
wndInfo = WIN_GetPtr(hwnd); if (!IsWindow(hwnd)) return FALSE;
if (!wndInfo) return FALSE;
if (wndInfo == WND_OTHER_PROCESS)
{
FIXME("window belong to other process\n");
return FALSE;
}
pwi->rcWindow = wndInfo->rectWindow; GetWindowRect(hwnd, &pwi->rcWindow);
pwi->rcClient = wndInfo->rectClient; GetClientRect(hwnd, &pwi->rcClient);
pwi->dwStyle = wndInfo->dwStyle; /* translate to screen coordinates */
pwi->dwExStyle = wndInfo->dwExStyle; 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); pwi->dwWindowStatus = ((GetActiveWindow() == hwnd) ? WS_ACTIVECAPTION : 0);
/* if active WS_ACTIVECAPTION, else 0 */
pwi->cxWindowBorders = ((wndInfo->dwStyle & WS_BORDER) ? pwi->cxWindowBorders = pwi->rcClient.left - pwi->rcWindow.left;
GetSystemMetrics(SM_CXBORDER) : 0); pwi->cyWindowBorders = pwi->rcWindow.bottom - pwi->rcClient.bottom;
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->atomWindowType = GetClassLongW( hwnd, GCW_ATOM );
pwi->wCreatorVersion = GetVersion(); pwi->wCreatorVersion = 0x0400;
/* 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);
return TRUE; return TRUE;
} }