Hi i have a problem usign the function Process[] currentProcesses = Process.GetProcesses();
( Creates a new System.Diagnostics.Process component for each process resource on the local computer.)
it works fine when i test it from a windows form, but a i need to create a windows services and when run the services the values MainWindowTitle gives empty and MainWindowHandle gives 0, can anybody help me or give another way to do it.
Here is my code:
// Here gets the process
Process[] currentProcesses = Process.GetProcesses();
// Here te function where i checke those values
private List<IntPtr> SearchProcess(BLL.clsApplicationAppBlocker app, Process[] pro)
{
return pro.Where(p => p.MainWindowTitle
.ToLower()
.Contains(app.WindowsTitle.ToLower())
&& p.MainWindowHandle != IntPtr.Zero)
.Select(p => p.MainWindowHandle)
.ToList();
}