heres my code(its jsut suppose to detect if renegade is open)
Option Explicit
Dim RenStatus As String
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Sub cmdOpen_Click()
Shell "C:\Westwood\Renegade\Renegade.exe"
End Sub
Private Sub tmrRen_Timer()
Dim lRenegadehWnd As Long
Dim RenChecked As String
lRenegadehWnd = FindWindow("Renegade", vbNullString)
If lRenegadehWnd Then
lblRen.Caption = "Renegade is OPEN" 'Renegade.exe Is Open
RenStatus = "Open" 'Tell it Renegade is Open
cmdStart.Enabled = True
Else
lblRen.Caption = "Renegade is CLOSED" 'Renegade.exe Isn't Opened
RenStatus = "Not Open"
cmdStart.Enabled = False
'----------------------------'
End If
End Sub