Mar 3rd, 2004, 01:52 AM
Detect the program is running
This coding will going to show how to know whether ur application is running, if application running more than one time, the program will prompt the message and kill the process.
Let say my program is "SMS.exe"
Private Sub detect_Running()
Dim procs As Process()
Dim proc As Process
Dim i As Integer = 0
' get an array of all processes named "app" on server "serverName"
procs = Process.GetProcessesByName("SMS")
' go through each proc named "app" and wait for it to exit
For Each proc In procs
i += 1
If i > 1 Then
MsgBox("SMS Already running")