#include "stdafx.h"
#include <iostream>
#include <windows.h>
using namespace std;
struct test{
char name[100];
};
DWORD WINAPI Fun(LPVOID lpParamter)
{
//test* t = (test*)lpParamter;
char *c = (char *)lpParamter;
for(int i = 0;i<10;i++){ cout << c<<"Fun display!"<<endl; Sleep(2000);}
return NULL;
}
int main()
{
/*test *t1 = new test();
strcpy_s(t1->name,"子线程");*/
HANDLE hThread = CreateThread(NULL, 0, Fun, "子线程", 0, NULL);
CloseHandle(hThread);
for(int i = 0;i<10;i++){ cout<<"main display!"<<endl; Sleep(1000);}
//delete t1;
cin.get();
return 0;
}
时间: 2024-10-11 18:14:30