GetCurrentProcessId();
或者
#include<stdio.h> #include<process.h> int main()
#include<unistd.h>
#include<stdlib.h>
{
/*获得当前进程的进程ID和其父进程ID*/
printf("The PID of this process is %d/n",_getpid()); /*getpid函数作用是获得当前进程的PID*/
printf("The PPID of this process is %d/n",_getppid()); /*getppid函数作用是获得当前进程的父进程PPID*/
}