使用CreateThread创建线程并且传递参数问题
程序运行出现问题 请教高手先谢
#include <windows.h>
#include <iostream.h>
DWORD WINAPI Func(LPVOID p);
typedef struct
{
int firstArgu;
long secArgu;
}myType,* pMyType;
void main()
{
pMyType pMyTpeyArgu;
pMyTpeyArgu->firstArgu=1;
pMyTpeyArgu->secArgu=100000000;
static HANDLE hHandle1;
hHandle1=CreateThread(NULL,0,Func,pMyTypeArgu,0,NULL);
Sleep(5000);
cout<<"该线程已删除……"<<endl;
ExitThread(0);
}
DWORD WINAPI Func(LPVOID p)
{
int intValue=((pMyType)LPVOID)->firstArgu;
long longValue=((pMyType)LPVOID)->secArgu;
cout <<"Thread is running,线程正在运行,5秒钟后该线程将自动删除"<<endl;
cout <<"现在输出该线程函数传递的两个参数:"<<endl;
cout <<"firstArgu="<<intValue<<";"<<"secArgu="<<longValue<<"."<<endl;
cout<<"请等待……"<<endl<<endl;
return(0);
}