Process Monitoring - GetProcessesByName vs mutex

G

Guest

hi...

i sucessfully programmed a monitor wich is using GetProcessesByName to
monitor another process....and if the process is killed or closed, the
monitor restarts the process...

so far so good....but on some machines the GetProcessesByName method isn´t
working (because of the "process performance counter disabled...blabla")
this method isn´t very relyable ...

so i tried to programm a solution using the mutex threadding object...
but i have some problems with it.... it´s just working once :)

any suggestion or code samples?

kind regrads
 
V

Vadym Stetsyak

AFAIK is is better to organize interprocess communication channel ( IPC ).
For example you can do that with sockets.

This method will work only if you have the source code of the process you
want to control...

In the other way you can use WMI, see System.Management namespace for more
details

ManagementObjectSearcher searcher = new ManagementObjectSearcher
("SELECT * FROM Win32_Process WHERE Name = MyProcess");
foreach (ManagementObject process in searcher.Get())
Console.WriteLine("Process = " + process["Name"]);
 
G

Guest

great!
it works...thank you a lot !!!

Vadym Stetsyak said:
AFAIK is is better to organize interprocess communication channel ( IPC ).
For example you can do that with sockets.

This method will work only if you have the source code of the process you
want to control...

In the other way you can use WMI, see System.Management namespace for more
details

ManagementObjectSearcher searcher = new ManagementObjectSearcher
("SELECT * FROM Win32_Process WHERE Name = MyProcess");
foreach (ManagementObject process in searcher.Get())
Console.WriteLine("Process = " + process["Name"]);

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com


Zabby said:
hi...

i sucessfully programmed a monitor wich is using GetProcessesByName to
monitor another process....and if the process is killed or closed, the
monitor restarts the process...

so far so good....but on some machines the GetProcessesByName method isn?t
working (because of the "process performance counter disabled...blabla")
this method isn?t very relyable ...

so i tried to programm a solution using the mutex threadding object...
but i have some problems with it.... it?s just working once :)

any suggestion or code samples?

kind regrads
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top