Aug 19, 2009 at 9:03am UTC
Hello.
I'd like to check if anyone here has done it and how
PS: I wont need this for a while since I have other stuff to code atm
Last edited on Aug 19, 2009 at 10:11am UTC
Aug 19, 2009 at 10:19am UTC
ok please clearify your Que.
Aug 19, 2009 at 2:03pm UTC
I need to know size and position of all windows that the user can see.
Aug 19, 2009 at 5:31pm UTC
Last edited on Aug 19, 2009 at 5:31pm UTC
Aug 20, 2009 at 12:32am UTC
And search for what? I remember trying this once, but I had problems obtaining only the ones I needed.
Thanks
Aug 20, 2009 at 2:32am UTC
What do you mean "what"?? Your question is clearly answered by EnumWindows(). "How can I get to know the size and position of all windows visible?" That is your question, is it not?
Well, then the answer is "Use EnumWindows() to obtain a window handle of all top-level windows. In case you don't know, you can use the handle to obtain the size and position of the window.".
If I'm wrong, then I'm clearly forgetting English.
Aug 20, 2009 at 11:15am UTC
yes web jose u r right . thanks for your responce on forms
Aug 24, 2009 at 6:34pm UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
BOOL CALLBACK EnumWindowsProc(__in HWND hWnd, __in LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
BOOL bVisible;
RECT WindowRect;
GetWindowRect(hWnd, &WindowRect);
bVisible = IsWindowVisible(hWnd);
_tprintf(_T("== HWND [%d] ==\n" ), hWnd);
_tprintf(_T(" -Visibility: %s\n" ), (bVisible ? _T("visible" ) : _T("invisible" )));
_tprintf(_T(" -Left: %d\n" ), WindowRect.left);
_tprintf(_T(" -Top: %d\n" ), WindowRect.top);
_tprintf(_T(" -Right: %d\n" ), WindowRect.right);
_tprintf(_T(" -Bottom: %d\n" ), WindowRect.bottom);
_tprintf(_T(" -Height: %d\n" ), WindowRect.bottom - WindowRect.top);
_tprintf(_T(" -Width: %d\n" ), WindowRect.right - WindowRect.left);
// do shit with following variables:
// bVisible -> is window visible or not
// WindowRect.left/top/right/bottom: window left/top/right/bottom
// WindowRect.bottom - WindowRect.top: window height
// WindowRect.right - WindowRect.left: window width
_gettchar();
return TRUE;
}
int __cdecl _tmain(__in int argc, __in_ecount_z_opt(argc) _TCHAR* __targv[], __in_z_opt _TCHAR* __tenviron[])
{
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(__targv);
UNREFERENCED_PARAMETER(__tenviron);
EnumWindows((WNDENUMPROC)EnumWindowsProc, NULL);
return EXIT_SUCCESS;
}
Last edited on Aug 24, 2009 at 6:38pm UTC