Hi Programmers. I must write program which it can start other *.exe programs. Problem with single instance. I use for run application Process.Start (Path). How can i, if the starting program is already running, and if it is started again, make this running program active otherwise if it is not running start it.
CODE
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void StartProgram(string prg)
{
myprc = Process.Start(prg);
}
private void listBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char) Keys.Enter)
{
StartProgram(AllProgs.IniReadValue("Path", "path" + (listBox1.SelectedIndex+1).ToString()));
}
}
private void listBox1_DoubleClick(object sender, EventArgs e)
{
// Process[] prc = Process.GetProcessesByName(listBox1.SelectedIndex.ToString());
StartProgram(AllProgs.IniReadValue("Path", "path" + (listBox1.SelectedIndex + 1).ToString()));
This post has been edited by sarvarbek: 26 Jun, 2008 - 11:19 PM