How do I get the current Process Name?

I need to be able to retrieve the process name from a C/C++ shared library. "_getpid()" retrieves the process ID, what is the equivalent for getting the process name?

Thanks!
magentaAsked:
Who is Participating?
 
nietodConnect With a Mentor Commented:
There is no such thing as a "process name."  i.e the OS does not record such a thing, programs don't supply such a thing.  Although users may refer to programs as if they have a name.

However, a process does have a file name, that is, the name of the EXE that was run to create the process.  You can get this name using GetModuleFileName().

Let me know if you have any questions.
0
All Courses

From novice to tech pro — start learning today.