On Feb 20, 2007 10:20 PM, Ryan Dary wrote:
> When the window is minimized or maximized upon quitting, I believe the
> values are something like -32000 or +32000 instead of that actual window
> size.
When is minimized the positions are set to -32000 and the dimensions to 0!
When is maximized the positions and dimensions are correct (not +32000).

> Now when I use these values to restore the window, the window is
> minimized to the task bar and it can't be brought out of the task bar again.
>
> Can anyone tell me, or tell me where to find out, what the right way to
> save and restore window location/size on Windows?

Other users already gave you a workaround for this, by showing/restoring the
window before closing it. But this does not solve a problem. What if the window
was maximized? You should store this state and then when opening the window set
it to maximized if it was previously maximized.

Unfortunately RB does not provide a way to know if the window is maximized or
not. For this I use the following Windows API before saving the window prefs.

Function IsMaximized(Extends wnd As Window) As Boolean
 // Returns if a window is maximized
 #If TargetWin32
  Soft Declare Function IsZoomed Lib "user32" (hwnd As Integer) As Integer
  If System.IsFunctionAvailable( "IsZoomed", "user32" ) Then
   If IsZoomed( wnd.WinHWND ) <> 0 Then
    Return True
   End If
  End If
 #EndIf
End Function

And on the window CancelClose event I set on my Prefs module the WindowMaximized
property by using:
Prefs.WindowMaximized = Self.IsMaximized

When opening the window, you can use Self.Maximize if the window was previously
maximized.

HTH
Carlos

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to