G
Guest
How do you find the classname or window name of a program. Tom O. gave me some code to check and see if a program is open. We used notpad as the example. The code works great, however when I try to aply this to another program it doesnot work. I think it is becasue I have the wrong classname for the program. I am posting the code that Tom posted for me. TI
Private Declare Function FindWindow
Lib "user32"
Alias "FindWindowA"
(
ByVal lpClassName As String,
ByVal lpWindowName As String
)
As Lon
Sub CheckNotepad(
Dim hwnd As Lon
hwnd = FindWindow("Notepad", vbNullString
If hwnd <> 0 The
MsgBox "Notepad is running
Els
MsgBox "Notepad is not running
End I
End Sub
Private Declare Function FindWindow
Lib "user32"
Alias "FindWindowA"
(
ByVal lpClassName As String,
ByVal lpWindowName As String
)
As Lon
Sub CheckNotepad(
Dim hwnd As Lon
hwnd = FindWindow("Notepad", vbNullString
If hwnd <> 0 The
MsgBox "Notepad is running
Els
MsgBox "Notepad is not running
End I
End Sub