VB Code:
  1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  2. Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
  3. Private Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long
  4.  
  5. ' Outlook Express Window Class Version 4 (4.72.3110.5)
  6. Const OE4WinClass As String = "ThorBrowserWndClass"
  7. ' Outlook Express Window Class Version 5 (5.50.4807.1700)
  8. Const OE5WinClass As String = "Outlook Express Browser Class"
  9.  
  10. Private Sub Form_Load()
  11.     MsgBox "Outlook Express 4 - window " & OEWindowState(OE4WinClass)
  12.     MsgBox "Outlook Express 5 - window " & OEWindowState(OE5WinClass)
  13. End Sub
  14.  
  15. Private Function OEWindowState(sVersion As String) As String
  16.  
  17.   Dim lHwnd As Long
  18.   OEWindowState = "not found"
  19.  
  20. ' Get Outlook Express window handle
  21.   lHwnd = FindWindow(sVersion, vbNullString)
  22.  
  23.   If lHwnd <> 0 Then ' If found
  24.      OEWindowState = "Normal"
  25.      If IsIconic(lHwnd) Then OEWindowState = "minimized"
  26.      If IsZoomed(lHwnd) Then OEWindowState = "maximized"
  27.   End If
  28.  
  29. End Function