PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Rolf Brandt on March 01, 2007, 04:17:35 AM

Title: WindowState
Post by: Rolf Brandt on March 01, 2007, 04:17:35 AM
Hello,

can anyone tell me how to find out the current window state, like maximized, minimized, or normal?

Background:
If a program terminates I want to write its current size and position to an ini file or the registry - but only if WindowState is normal. If the Window is minimized its left/top coordinates are about half a mile out of the desktop region. (That's actually how Windows minimizes a dialog.)

Rolf
Title: WindowState
Post by: TechSupport on March 01, 2007, 09:27:15 AM
Check out the IsZoomed and IsIconic api functions.


If IsZoomed(hWnd) Then
  EditorOptions.initPosition.WindowState = %SW_SHOWMAXIMIZED
ElseIf IsIconic(hWnd) Then
  EditorOptions.initPosition.xsize = 0.75 * GetSystemMetrics(%SM_CXSCREEN)
  EditorOptions.initPosition.ysize = 0.75 * GetSystemMetrics(%SM_CYSCREEN)
  EditorOptions.initPosition.xpos = (GetSystemMetrics(%SM_CXSCREEN) - (EditorOptions.initPosition.xsize)) \ 2  '%CW_USEDEFAULT
  EditorOptions.initPosition.ypos = (GetSystemMetrics(%SM_CYSCREEN) - (EditorOptions.initPosition.ysize)) \ 2  '%CW_USEDEFAULT
  EditorOptions.initPosition.WindowState = %SW_SHOWNORMAL
Else
  EditorOptions.initPosition.WindowState = %SW_SHOWNORMAL
End If
Title: WindowState
Post by: Rolf Brandt on March 01, 2007, 10:02:51 AM
Thank you for the quick help!

Rolf