Finding form's Restore size and location

  • Thread starter Thread starter Jeremy Williams
  • Start date Start date
J

Jeremy Williams

Is there a way to determine the "restorable" size and location of a formn
when it is minimized? When a form is minimized, the values for left, top,
height and width are off from what I need. When you restore the form, it
snaps back to it's last normal size and position, so I know those values are
stored somewhere. Does anyone know how to get those values? Thanks in
advance for the help.
 
Hi,

You have to use the getwindowsplacement api to get that info.

api declare
Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As
IntPtr, _

ByRef lpwndpl As WINDOWPLACEMENT) As Integer



structures

Private Structure POINTAPI

Dim X As Integer

Dim Y As Integer

End Structure

Private Structure RECT

Dim Left As Integer

Dim Top As Integer

Dim Right As Integer

Dim Bottom As Integer

End Structure

Private Structure WINDOWPLACEMENT

Dim length As Integer

Dim flags As Integer

Dim showCmd As Integer

Dim ptMinPosition As POINTAPI

Dim ptMaxPosition As POINTAPI

Dim rcNormalPosition As RECT

End Structure



How to use



Dim hWnd As IntPtr

Dim wp As WINDOWPLACEMENT

hWnd = Me.Handle

GetWindowPlacement(hWnd, wp)



Ken
 
Back
Top