Click to See Complete Forum and Search --> : Determining if a window is visible
sTyLeZ
Jan 27th, 2001, 03:35 PM
Is there an API call to determine the status of a window (like if it's minimized, hidden, maximized, etc.)? Would I be able to use the API function GetProp(hWnd, lpString), using "WindowState" as the string parameter?
Use these API functions to determine whether a window is hidden, maximized, or minzimized.
IsWindowVisible (Visibility)
IsIconic (Minimized)
IsZoomed (Maximized)
Private Declare Function IsWindowVisible Lib "user32" _
Alias "IsWindowVisible" (ByVal hwnd As Long) As Long
Usage
Private Sub Command1_Click()
If IsWindowVisible(hWnd) Then
Msgbox "Window is visible"
Else
Msgbox "Window is not visible"
End If
End Sub
Private Declare Function IsIconic Lib "user32" _
Alias "IsIconic" (ByVal hwnd As Long) As Long
Usage
Private Sub Command1_Click()
If IsIconic(hWnd) Then
Msgbox "Window is minimzed"
Else
Msgbox "Window is not minimized"
End If
End Sub
Private Declare Function IsZoomed Lib "user32" _
Alias "IsZoomed" (ByVal hwnd As Long) As Long
Usage
Private Sub Command1_Click()
If IsZoomed(hWnd) Then
Msgbox "Window is maximized"
Else
Msgbox "Window is not maximized"
End If
End Sub
sTyLeZ
Jan 27th, 2001, 04:28 PM
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.