WindowState

Started by Rolf Brandt, March 01, 2007, 04:17:35 AM

Previous topic - Next topic

Rolf Brandt

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

TechSupport

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

Rolf Brandt

Thank you for the quick help!

Rolf