#include "stdafx.h"
#include <Windows.h>
#include <iostream>
using namespace std;int index=0;
DWORD WINAPI Fun1Proc(
LPVOID lpParameter
);int _tmain(int argc, _TCHAR* argv[])
{
HANDLE hThread1;
hThread1=CreateThread(NULL,0,Fun1Proc,NULL,0,NULL);
//Sleep(1000);

CloseHandle(hThread1);

while(index++<20)
cout<<"main thread is running "<<endl;


system("pause"); return 0;
}DWORD WINAPI Fun1Proc(
LPVOID lpParameter
)
{while(index++<20)
cout<<"thread1 is running "<<endl;
return 0;
}