Got this from a previous posting:
Just add that piece of code (here in C#) in your main method (you need to
include the System.Diagnostic namespace) :
Process currentProcess = Process.GetCurrentProcess();
Process [] allProcesses =
Process.GetProcessesByName(currentProcess.ProcessN ame);
if (allProcesses.Length > 1)
{
MessageBox.Show(currentProcess.ProcessName + " is already running !",
currentProcess.ProcessName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
//do your stuff here
}
"Derek Hart" <dm****@gte.net> wrote in message
news:eL**************@tk2msftngp13.phx.gbl...
I have a VB6 program that is going to Shell a VB.Net program to run. I
want the VB.Net program to only run once, so it if is not running and it is
Shelled, the program runs; if it is already running and it is Shelled,
then I wish the program to become visible. I do have to use the Shell process
since I do not have control over the VB6 program, other than what
parameters are sent to the Shell. Any ideas on how this can be accomplished?
Thank You,
Derek