From ca30e48f71ee31c87d6f5d2366df3d6d37fbbed4 Mon Sep 17 00:00:00 2001 From: David Hammerton Date: Mon, 6 May 2002 20:11:18 +0000 Subject: [PATCH] Added implementation of GetWindowInfo. --- dlls/user/user32.spec | 1 + include/winuser.h | 38 ++++++++++++++++++++++--------- windows/win.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/dlls/user/user32.spec b/dlls/user/user32.spec index 828239f3452..e9edfb7879e 100644 --- a/dlls/user/user32.spec +++ b/dlls/user/user32.spec @@ -327,6 +327,7 @@ debug_channels (accel caret class clipboard combo comm cursor dc ddeml dialog @ stdcall GetWindowTextW(long ptr long) GetWindowTextW @ stdcall GetWindowThreadProcessId(long ptr) GetWindowThreadProcessId @ stdcall GetWindowWord(long long) GetWindowWord +@ stdcall GetWindowInfo(long ptr) GetWindowInfo @ stdcall GrayStringA(long long ptr long long long long long long) GrayStringA @ stdcall GrayStringW(long long ptr long long long long long long) GrayStringW @ stdcall HideCaret(long) HideCaret diff --git a/include/winuser.h b/include/winuser.h index b7d95facdd0..0b0f5b9c435 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -3483,6 +3483,23 @@ typedef HDEVNOTIFY *PHDEVNOTIFY; #define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000 +/* used for GetWindowInfo() */ + +#define WS_ACTIVECAPTION 0x0001 + +typedef struct tagWINDOWINFO { + DWORD cbSize; + RECT rcWindow; + RECT rcClient; + DWORD dwStyle; + DWORD dwExStyle; + DWORD dwWindowStatus; + UINT cxWindowBorders; + UINT cyWindowBorders; + ATOM atomWindowType; + WORD wCreatorVersion; +} WINDOWINFO, *PWINDOWINFO, *LPWINDOWINFO; + #define EnumTaskWindows(handle,proc,lparam) \ EnumThreadWindows(handle,proc,lparam) #define OemToAnsiA OemToCharA @@ -3937,25 +3954,24 @@ BOOL WINAPI GetUserObjectInformationW(HANDLE,INT,LPVOID,DWORD,LPDWORD); #define GetUserObjectInformation WINELIB_NAME_AW(GetUserObjectInformation) HWND WINAPI GetWindow(HWND,UINT); HDC WINAPI GetWindowDC(HWND); +BOOL WINAPI GetWindowInfo(HWND, PWINDOWINFO); LONG WINAPI GetWindowLongA(HWND,INT); LONG WINAPI GetWindowLongW(HWND,INT); #define GetWindowLong WINELIB_NAME_AW(GetWindowLong) -BOOL WINAPI GetWindowPlacement(HWND,LPWINDOWPLACEMENT); -BOOL WINAPI GetWindowRect(HWND,LPRECT); -INT WINAPI GetWindowRgn(HWND,HRGN); +BOOL WINAPI GetWindowPlacement(HWND,LPWINDOWPLACEMENT); +BOOL WINAPI GetWindowRect(HWND,LPRECT); +INT WINAPI GetWindowRgn(HWND,HRGN); HWINSTA WINAPI GetProcessWindowStation(void); #define GetWindowTask(hwnd) ((HTASK)GetWindowThreadProcessId(hwnd,NULL)) -INT WINAPI GetWindowTextA(HWND,LPSTR,INT); -INT WINAPI GetWindowTextW(HWND,LPWSTR,INT); +INT WINAPI GetWindowTextA(HWND,LPSTR,INT); +INT WINAPI GetWindowTextW(HWND,LPWSTR,INT); #define GetWindowText WINELIB_NAME_AW(GetWindowText) -INT WINAPI GetWindowTextLengthA(HWND); -INT WINAPI GetWindowTextLengthW(HWND); +INT WINAPI GetWindowTextLengthA(HWND); +INT WINAPI GetWindowTextLengthW(HWND); #define GetWindowTextLength WINELIB_NAME_AW(GetWindowTextLength) WORD WINAPI GetWindowWord(HWND,INT); -BOOL WINAPI GrayStringA(HDC,HBRUSH,GRAYSTRINGPROC,LPARAM, - INT,INT,INT,INT,INT); -BOOL WINAPI GrayStringW(HDC,HBRUSH,GRAYSTRINGPROC,LPARAM, - INT,INT,INT,INT,INT); +BOOL WINAPI GrayStringA(HDC,HBRUSH,GRAYSTRINGPROC,LPARAM,INT,INT,INT,INT,INT); +BOOL WINAPI GrayStringW(HDC,HBRUSH,GRAYSTRINGPROC,LPARAM,INT,INT,INT,INT,INT); #define GrayString WINELIB_NAME_AW(GrayString) BOOL WINAPI HideCaret(HWND); BOOL WINAPI HiliteMenuItem(HWND,HMENU,UINT,UINT); diff --git a/windows/win.c b/windows/win.c index 0b7acbcd0df..ca9ab70f826 100644 --- a/windows/win.c +++ b/windows/win.c @@ -3340,3 +3340,55 @@ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPSTR lpszFileName, UINT cchFil hwnd, lpszFileName, cchFileNameMax); return 0; } + +/****************************************************************************** + * GetWindowInfo (USER32.@) + * hwnd: in + * pwi: out. + * MS Documentation mentions that pwi->cbSize must be set to SIZEOF(WINDOWINFO) + * this may be because this structure changed over time. If this is the + * the case, then please: FIXME. + * Using the structure described in MSDN for 98/ME/NT(4.0 SP3)/2000/XP. + */ +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; + } + + pwi->rcWindow = wndInfo->rectWindow; + pwi->rcClient = wndInfo->rectClient; + pwi->dwStyle = wndInfo->dwStyle; + pwi->dwExStyle = wndInfo->dwExStyle; + 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); + return TRUE; +} +