Hello,
Im messing with processes for a project that Im doing, so if I detect that the specific process Im checking changes the title containing a specific word like "Hello" I will kill the process and start it again.
Im doing this with a timer so every X secs/minutes it checks for the title:
Process[] processPads = Process.GetProcessesByName("notepad");
foreach (Process processes in processPads)
{
if (!processes.MainWindowTitle.Contains("Untitled"))
{
processes.Kill();
Process.Start("notepad");
}
}
That's what I have and works and everything but when I click anything on the menu like "File/Edit/Format/View/Help/etc" If I click any of those notepad gets killed and it gets started again, I displayed it before killing it so when I click anything on the menu the mainwindowtitle is empty "", Its there a way to get the form title of that specific process ? Example if I have 5 notepads opened and #3 changes name and doesnt contain "Untitled" I want #3 killed and started again not another notepad getting killed.