Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long
' Outlook Express Window Class Version 4 (4.72.3110.5)
Const OE4WinClass As String = "ThorBrowserWndClass"
' Outlook Express Window Class Version 5 (5.50.4807.1700)
Const OE5WinClass As String = "Outlook Express Browser Class"
Private Sub Form_Load()
MsgBox "Outlook Express 4 - window " & OEWindowState(OE4WinClass)
MsgBox "Outlook Express 5 - window " & OEWindowState(OE5WinClass)
End Sub
Private Function OEWindowState(sVersion As String) As String
Dim lHwnd As Long
OEWindowState = "not found"
' Get Outlook Express window handle
lHwnd = FindWindow(sVersion, vbNullString)
If lHwnd <> 0 Then ' If found
OEWindowState = "Normal"
If IsIconic(lHwnd) Then OEWindowState = "minimized"
If IsZoomed(lHwnd) Then OEWindowState = "maximized"
End If
End Function