Link to home
Start Free TrialLog in
Avatar of rishi_raj
rishi_raj

asked on

Identify a process in memory

How do I identify if a process is currently running in memory, in a Windows NT or Windows 98 machine? (How does the task manager show us the current process information?)
To identify programatically using C.
I want only one instance of my application running at a point of time.
Avatar of gcauthon
gcauthon
Flag of United States of America image

Go to msdn.microsoft.com and search for psapi (process status api).  You probably want to look at EnumProcesses() first.  This returns the list of pid's and OpenProcess(pid) will give you a handle to the process.  With this you can find anything out about a given process (assuming you have enough security privileges).
Avatar of Mayank S
Just wondering.... <text removed from AnnieMod as a private info for another member>

Mayank.
ASKER CERTIFIED SOLUTION
Avatar of bkrahmer
bkrahmer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why was it a fatal mistake?  Are you going to hunt me down with an AK-47 or something?
Avatar of bkrahmer
bkrahmer

It's just an expression.  Chill out dude.  I was just trying to make the point that if people have a question about how to solve a problem, they should simply verify they are taking the correct approach by asking a more general question.  Once they are sure they are using the right approach, then they can worry about how to solve their implementation problems.  No worries.

brian
Avatar of rishi_raj

ASKER

Thanks buddies. Let me do a chk at my end.
And Mayank, sorry to disappoint you, I am not Rishi Raj from Michigan.
Nothing has happened on this question in more than 9 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by bkrahmer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
Thanks for the recommendation. I will follow it. I had seen some experts (who have been using EE for a long time and who have plenty of expert points) doing it, so I thought that there is nothing wrong with it. But I guess it is against some policies.

Regards,
Mayank.