简体   繁体   中英

Unmanaged C++ Get the current process id? (Console Application)

How can I get the current process id from an unmanaged C++ console application? I see that

GetWindowThreadProcessId

Works when you have an HWND, but what can I do for a console application?

GetCurrentProcessId

Exact same question? Windows

In unix you can go:

#include <sys/types.h>
#include <unistd.h>

pid_t getpid(void);
pid_t getppid(void);

DESCRIPTION getpid() returns the process ID of the current process. (This is often used by routines that generate unique temporary filenames.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM