There may be other ways, but this should work:
VB Code:
Private Type POINTAPI x As Long y As Long End Type Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type WINDOWPLACEMENT Length As Long flags As Long showCmd As Long ptMinPosition As POINTAPI ptMaxPosition As POINTAPI rcNormalPosition As RECT End Type Private Declare Function GetWindowPlacement Lib "user32" ( _ ByVal hWnd As Long, _ lpwndpl As WINDOWPLACEMENT) As Long Private Const SW_NORMAL As Long = 1 Private Const SW_MINIMIZE As Long = 6 Private Const SW_MAXIMIZE As Long = 3 Private Function GetWindowState(ByVal lhWnd As Long) As FormWindowStateConstants Dim winPLACE As WINDOWPLACEMENT winPLACE.Length = Len(winPLACE) GetWindowPlacement lhWnd, winPLACE Select Case winPLACE.showCmd Case SW_MINIMIZE GetWindowState = vbMinimized Case SW_MAXIMIZE GetWindowState = vbMaximized End Select End Function




Reply With Quote