"Andy" <aj********@capcitypress.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi all,
Just started having a problem with this. It seems now that
GetProcessesByName will block for about 10-15 seconds before returning.
It never happened before, this is a recent development.
I'm NOT trying to prevent another instance of my program from starting,
so those solutions aren't applicable to my problem.
I've also read that some people claim the call causes access to the
floppy drive; I don't believe thats my problem here as I'm on a laptop
without a floppy drive.
Any ideas?
Thanks
Andy
Better use System.Management classes for this.
using System.Management;
static void GetProcess(string Id)
{
SelectQuery query = new SelectQuery("SELECT * FROM win32_process where
Name ='" + Id +"'");
using(ManagementObjectSearcher searcher = new
ManagementObjectSearcher(query))
{
foreach(ManagementObject proc in searcher.Get())
{
foreach(PropertyData pd in proc.Properties)
Console.WriteLine("Property: {0}, Value: [{1}]",pd.Name,
pd.Value);
}
}
}
.....
GetProcess("explorer.exe");
Willy.