سلام نمیدونم چیزی که میخواین اینه ؟ :
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
public static bool ___CheckAppTitles()
{
List<string> vs = new List<string>(new string[]
{
"AppTitle3",
"AppTitle2"
});
if (___Is_App_Running(vs) == true)
{
return true;
}
try
{
if (FindWindow("AppClass1" , null) != IntPtr.Zero)
{
return true;
}
if (FindWindow("AppClass2", null) != IntPtr.Zero)
{
return true;
}
}
catch
{
return true;
}
return false;
}
private static bool ___Is_App_Running(List<string> Apps_Window)
{
try
{
Process[] processlist = Process.GetProcesses();
foreach (Process process in processlist)
{
if (!String.IsNullOrEmpty(process.MainWindowTitle))
{
foreach (string AppTitle in Apps_Window)
{
if (process.MainWindowTitle.ToLower().Contains(AppTit le) == true ||
process.MainWindowTitle.ToUpper().Contains(AppTitl e) == true) return true;
}
}
}
return false;
}
catch
{
return false;
}
}
ضمنا این کد رو میتونی توی یه تایمر بذاری هر مثلا 10 ثانیه یکبار چک کنه.
نکته : برای بدست آوردین اسم کلاس برنامه ها از نرم افزار SPY++ یا چیزی شبیه به اون استفاده کنین.
SPY++
winSpector