I include the code also because someone else might need such an
application.
Take care of yourself,
Vio
--------
The code:
'---form code---
Private Sub Command1_Click()
Dim h As Long
Dim r
Debug.Print IsAppRunning("Explorer", h), h
If h > 0 Then
r = MsgBox(" Explorer is running")
End If
If h = 0 Then
r = MsgBox("Explorer is not running")
End If
End Sub
'---Bas module---
Private Declare Function FindWindow Lib "user32"
Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As
String) As Long
Private Declare Function GetWindow Lib "user32"
(ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetWindowText Lib
"user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As
String, ByVal cch As Long) As
Long
Private Declare Function GetParent Lib "user32"
(ByVal hwnd As Long) As Long
Public Const GW_HWNDNEXT = 2
Public Function IsAppRunning(TitlePart As String,
Optional AppHwnd As Long = 0) As Boolean
Dim h As Long, k As Long
Dim sName As String
h = FindWindow(vbNullString, vbNullString)
Do Until h = 0
If GetParent(h) = 0 Then
sName = Space(256)
k = GetWindowText(h, sName,
Len(sName))
If k > 0 Then
sName = UCase(Left(sName, k))
If InStr(sName, UCase(TitlePart))
Then
AppHwnd = h
IsAppRunning = True
Exit Do
End If
End If
End If
h = GetWindow(h, GW_HWNDNEXT)
Loop
End Function
Sent via Deja.com http://www.deja.com/
Before you buy.
Juergen.