#include <iostream>
#include <windows.h>
using namespace std;
DWORD WINAPI ThreadProc(LPVOID LPparam)
{
char* Name = (char *)LPparam;
cout << Name << endl;
int i = 0;
while (i < 20)
{
cout << "Print Thread: " << i++ << endl;
}
return 0;
}
int main()
{
DWORD ThreadID = 0;
char* ThreadName = const_cast<char*>("Thread first");
HANDLE mCreadThread = CreateThread(nullptr, 0, ThreadProc, (void*)(ThreadName), 0, &ThreadID);
if (!mCreadThread)
{
}
WaitForSingleObject(mCreadThread, INFINITE);
CloseHandle(mCreadThread);
system("pause");
return 0;
}