A comment by theB linked to good resources for Java. I'll run through the relevant Windows APIs, in case you want to go native with C++.
To enumerate all the top-level windows in the system, use EnumWindows
. You give it a callback function with the signature of EnumWindowsProc
, so it will receive each window handle as the first parameter.
You can get the window location (in screen coordinates) and dimensions with the GetWindowRect
function. Pass in the window handle you received and get an LPRECT
(pointer to RECT
) out.
To determine whether a window is maximized, use GetWindowPlacement
and check the showCmd
field of the WINDOWPLACEMENT
structure you receive.
Finally, to get a window's caption, use GetWindowText
. (As an aside, if you want to get the text of a control in another process, you'll need to send the WM_GETTEXT
message yourself.)