Windows获取当前线程,当前进程的ID
获取当前线程的id
方法一:
#include <thread>
thread::id currentID = this_thread::get_id();
cout<<"当前线程的ID是:"<<thread::id<<endl;
方法二:
int threadID = GetCurrentThreadId();
cout<<"当前线程的ID是:"<<threadID<<endl;
获取当前进程的id
int processID = GetCurrentProcessId();
cout<<"当前进程的ID是:"<<processID<<endl;