#include <windows.h> #include <iostream> using namespace std; #include <process.h> unsigned int _stdcall ThreadProc(void *param) { HANDLE hThreadParent = (HANDLE)param; FILETIME ftCreateTime,ftExitTime,ftKernelTime,ftUserTime; GetThreadTimes(hThreadParent,&ftCreateTime,&ftExitTime,&ftKernelTime,&ftUserTime); cout<<"ftCreateTime : "<<ftCreateTime.dwHighDateTime<<" "<<ftCreateTime.dwLowDateTime<<endl; cout<<"ftExitTime : "<<ftExitTime.dwHighDateTime<<" "<<ftExitTime.dwLowDateTime<<endl; cout<<"ftKernelTime : "<<ftKernelTime.dwHighDateTime<<" "<<ftKernelTime.dwLowDateTime<<endl; cout<<"ftUserTime : "<<ftUserTime.dwHighDateTime<<" "<<ftUserTime.dwLowDateTime<<endl; //CloseHandle(hThreadParent); _endthreadex(0); return 0; } void main(int argc,TCHAR* argv[]) { HANDLE hThreadParent = GetCurrentThread(); FILETIME ftCreateTime,ftExitTime,ftKernelTime,ftUserTime; GetThreadTimes(hThreadParent,&ftCreateTime,&ftExitTime,&ftKernelTime,&ftUserTime); cout<<"ftCreateTime : "<<ftCreateTime.dwHighDateTime<<" "<<ftCreateTime.dwLowDateTime<<endl; cout<<"ftExitTime : "<<ftExitTime.dwHighDateTime<<" "<<ftExitTime.dwLowDateTime<<endl; cout<<"ftKernelTime : "<<ftKernelTime.dwHighDateTime<<" "<<ftKernelTime.dwLowDateTime<<endl; cout<<"ftUserTime : "<<ftUserTime.dwHighDateTime<<" "<<ftUserTime.dwLowDateTime<<endl<<endl; //DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&hThreadParent,0,FALSE,DUPLICATE_SAME_ACCESS); HANDLE hThread = (HANDLE)_beginthreadex(NULL,0,ThreadProc,(void*)hThreadParent,0,NULL); CloseHandle(hThread); Sleep(4000); }