#include <stdio.h>
#include <iostream>
#include <windows.h>
using namespace std;
//定义线程调用函数
DWORD WINAPI ThreadProc(LPVOID lpParamter)
{
int iRunTime = 0;
while(++iRunTime<10)//执行10次跳出
{
cout << "ThreadProc() is running!"<<endl;
Sleep(10);
}
//ExitThread(-1);
return 0;
}
int main()
{
//定义变量接受线程返回ID
unsigned long ulThreadId = 0;
//创建线程
HANDLE hThread = CreateThread(NULL, 0, ThreadProc, NULL, 0, &ulThreadId);
//关闭资源
CloseHandle(hThread);
//cout << ulThreadId <<endl;
getchar();
//system("pause");
return 0;
}