Hi All,
What try to do;
I have 2 Application. First App is "_Exe" and Second App is "Third". I need the program "_Exe" monitor the program "Third"
IF program "Third" start then "_Exe" raise a message" Program is Running now".
May be the program "_Exe" always running??.how to prepare the code like that.
Here some trial but I don't excatly to do.
Thank.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _Exe
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public bool IsProcessOpen(string name)
{
foreach (Process clsProcess in Process.GetProcesses())
{
if (clsProcess.ProcessName.ToLower().Contains(name.ToLower()))
{
return true;
}
}
return false;
}
private void Form1_Load(object sender, EventArgs e)
{
Process thisProc = Process.GetCurrentProcess();
if (IsProcessOpen(name : "Third"))
{
MessageBox.Show("Program is Running now");
}
else
{
//MessageBox.Show("Not Run");
}
}
}
}