M
Martin
Hello,
I have some code that tests to see if Notepad is open:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
Sub CheckNotepad()
Dim hwnd As Long
hwnd = FindWindow("Notepad", vbNullString)
If hwnd <> 0 Then
MsgBox "Notepad is running"
Else
MsgBox "Notepad is not running"
End If
End Sub
I would like to amend this to check if a .bat file is open and if it is then
close it.
Does anyone know how to do this? I cant figure out how to change this code
to do that.
Many thanks in advance.
Martin
I have some code that tests to see if Notepad is open:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
Sub CheckNotepad()
Dim hwnd As Long
hwnd = FindWindow("Notepad", vbNullString)
If hwnd <> 0 Then
MsgBox "Notepad is running"
Else
MsgBox "Notepad is not running"
End If
End Sub
I would like to amend this to check if a .bat file is open and if it is then
close it.
Does anyone know how to do this? I cant figure out how to change this code
to do that.
Many thanks in advance.
Martin