views:

120

answers:

2

It's easy to get the bounding rectangle for all the visible windows on a screen. It's also easy to tell if any window is iconic or not.

But for minimized windows, the Top and Left is reported as -32000 from User32.GetWindowInfo.rcWindow. I've looked all through the API and can't find a call to return the bounds the window would restore to if it were clicked on or switched to.

Thanks for any pointers.

+1  A: 

Check out User32.GetWindowPlacement

Rune
Seems to work great thanks... except for some owner drawn windows like WinAmp, which reports its bounds as {X=3806,Y=-30000,Width=4081,Height=-29884}Any idea how to get the actual bounds for it?
Hm, check for 'impossible' values and call GetWindowRect/send WM_NCCALCSIZE is the only solution that comes to mind.
Rune
A: 

For C/C++:

WINDOWPLACEMENT wp;
::ZeroMemory(&wp, sizeof(WINDOWPLACEMENT));
::GetWindowPlacement(hWnd, &wp);
sean e