Hi,
Trying to determine if a program is running or not.
I implemented the example code below but I am getting handles returned
regardless of whether a program exists or not. i.e. You can feed in a
rubbish string for the lpClassName parameter and still get back a long > 0.
What am I doing wrong?
thanks
Bob
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
_
lpClassName As String, ByVal lpWindowName As String) As Long
Public Function GetHandleByClass(ByVal strTargetProgram As String) As Long
Try
Return FindWindow(strTargetProgram, vbNullString) ' Always returns a large
arbitary number
Catch ex As Exception
MsgBox("Gethandle error " & ex.Message)
End Try
End Function