473,386 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

GetProcessesByName takes 10-15 seconds?

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

Nov 17 '05 #1
5 2214
Andy,

I think that the reason this occurs is because of the fact that it
creates internal structures for all the processes on the machine, which can
take some time.

Not the most efficient way to do it, IMO. What are you trying to do?
Perhaps there is a workaround.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"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

Nov 17 '05 #2
GetProcessesByName works by getting it's information from a
PerformanceCounter. If the performance counter has become corrupt then that
could be causing your problem.

--
Brian Delahunty
Ireland

http://briandela.com/blog
"Andy" wrote:
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

Nov 17 '05 #3

"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.

Nov 17 '05 #4
Hmm.. it didn't take this long before, and I have roughly the same
number of processes running.

I'm trying to make sure that a certain windows application (Filemaker)
is open. Unfortunatly, to use ODBC with FM 6, you need to talk to a
filemaker client, which will talk to the server on your behalf.

I need to know if its running or not, so that i can attempt to start it
if it is not.

Thanks
Andy

Nov 17 '05 #5
Would the PC remain corrupt between reboots?

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Peter Stojkovic | last post by:
I call GetProcessesByName( myApplictaionName) to test wether an old application-instance of my software is running. Then always my disk-drive runs a short time The program and...
0
by: rollasoc | last post by:
Hi, One of our customers seem to be having an issue with our software getting the following exception on running the app. 'System.InvalidOperationException', with the message "Process...
2
by: Hans | last post by:
I am using Process.GetProcessesByName("SomeName") in my app and it workes on most windows platforms. On most - it does not work in a terminal server session on a Windows 2003 server. Although the...
5
by: hangten | last post by:
I have a service that 1) uses filewatcher to watch a directory on a remote machine. 2) checks if a certain application is running on the local machine before starting it. The problem is while...
5
by: Lord Fonty | last post by:
Hi All I posted this recently and no one responded so I am wondering if there are any guru's out there whould could help me: > I keep getting the above message when using >...
3
by: Steve Long | last post by:
Hello, I'm using the Process class to get all the current running processes on my machine and looking for a particular process. If I find the process, I want to kill it. However, I've recently...
4
by: JZ | last post by:
Hi, Has anyone else got this? I've downloaded the IT Professional network version of XP SP2 to test my programs. I found a problem with GetProcessesByName it just seems to hang. Private...
4
by: Samuel R. Neff | last post by:
Most of the time what I've read is that to keep only one instance of an app running one should use a Mutex. However, we have an existing app that uses GetProcessByName() to ensure only one...
2
by: kd | last post by:
Hi All, Process.GetProcessesByName() is not giving the expected results. Here is a sample code. Dim TestProcess() As Process Try TestProcess= Process.GetProcessesByName("Test.exe") If...
2
by: zdrakec | last post by:
Hello all: The following snippet: For Each p as Process in GetProcessesByName(procName) p.Kill() Next 'p fails with message:
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.