Visual c++ function for detecting a process running or not

hello,

i have the basic knowledge of c++ (like if, else, loops, classes, file handling, etc.). but i dont have the knowledge of .net platform.

please tell me any default function of visual c++ 2008 that can tell that a specific process is runing in the system or not ?
is there any other way using visual c++ ? please help.
i have visual studio 2008 with windows 7 rc.

i dont have a very sound knowledge of c++ so please provide a simple program link so that i can understand it correctly.
please also provide some example of it.

thanks


rahul
You want to use the CreateToolhelp32Snapshot() function
http://www.google.com/search?btnI=1&q=msdn+CreateToolhelp32Snapshot

First use TH32CS_SNAPPROCESS to enumerate all processes, then for each process, use TH32CS_SNAPMODULE to get the filename(s) of each process.

I don't know anything about .NET.

Hope this helps.
thanks for the reply. do u know anything about psapi.dll and how to link and use it in visual c++ 2008 ?
I don't know anything about it that I couldn't google. I imagine you use it like any other -- add it to the list of libraries to link into your project and #include the appropriate header(s).
Hi, i try to compile this example from msdn what Duoas give, and it's runing about couple seconds, and close it self. How can i see what list of this snapshot, or how can i save snapshot in txt file (like log file). And i forgot to say, i am beginer. Thank's for help.
Run it from the command prompt. Start->Run->"cmd.exe"; change to your application directory and run it. For example, if you saved your program on drive D in "prog\cc\myapp" and compiled it using an IDE in 'release mode':

C:\WINDOWS\system32> d:
D:> cd prog\cc\myapp\release
D:\prog\cc\myapp\release> myprog.exe


The other option is to add a pause at the end of your program...
http://www.cplusplus.com/forum/articles/7312/

Good luck!
thanks again for the wonderful info.
i have completed the first stage of my project.
the code i found(on msdn) is in c, can u suggest a good book for windows programming in c++, i found in c only.
Topic archived. No new replies allowed.