F
fniles
I am using VBNET 2008.
I am using a "command line argument" to run 2 different instances of
the program, say 1 instance to connect to program A, and another
instance to connect to program B. So, for 1 instance of the program,
in the program shortcut I append the letter "1", and for the B
instance I append the letter "2". For ex:
C:\program files\test\EServer\EServer.exe 1
C:\program files\test\EServer\EServer.exe 2
But, I do not want to allow running 2 copies of the same instance of
the program, ie I do not want to allow EServer.exe 1 to have 2 copies
running.
Is it possible to do that ?
Thank you.
I do not want to allow running 2 copies of my program
'This is how I get the command line arguments:
For Each s As String In My.Application.CommandLineArgs
sArgument = s
Next
If sArgument <> "" Then
iProcess = sArgument
Else
iProcess = 1
End If
'If I run these codes, I won't be able to run "C:\program files\test
\EServer\EServer.exe 1" and
"C:\program files\test\EServer\EServer.exe 2".
If
Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length
Process.GetCurrentProcess.ProcessName & " is already running !")
End
End If
I am using a "command line argument" to run 2 different instances of
the program, say 1 instance to connect to program A, and another
instance to connect to program B. So, for 1 instance of the program,
in the program shortcut I append the letter "1", and for the B
instance I append the letter "2". For ex:
C:\program files\test\EServer\EServer.exe 1
C:\program files\test\EServer\EServer.exe 2
But, I do not want to allow running 2 copies of the same instance of
the program, ie I do not want to allow EServer.exe 1 to have 2 copies
running.
Is it possible to do that ?
Thank you.
I do not want to allow running 2 copies of my program
'This is how I get the command line arguments:
For Each s As String In My.Application.CommandLineArgs
sArgument = s
Next
If sArgument <> "" Then
iProcess = sArgument
Else
iProcess = 1
End If
'If I run these codes, I won't be able to run "C:\program files\test
\EServer\EServer.exe 1" and
"C:\program files\test\EServer\EServer.exe 2".
If
Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length
MsgBox("Another instance of " &1 Then
Process.GetCurrentProcess.ProcessName & " is already running !")
End
End If