利用CreateThread函数传参遇见的问题
请问高手们程序错哪了……#include <windows.h>
#include <stdio.h>
DWORD WINAPI Func(LPVOID p);
void main()
{
struct myType
{
int firstArgu;
long secArgu;
}*myType;
struct myType MyTpey1;
struct myType * p;
p=&MyTpey1;
MyTpey1.firstArgu=1;
MyTpey1.secArgu=100000000;
static HANDLE hHandle1;
hHandle1=CreateThread(NULL,0,Func,p,0,NULL);
Sleep(5000);
printf("该线程已删除……\n");
ExitThread(0);
}
DWORD WINAPI Func(LPVOID p)
{
printf("Thread is running,线程正在运行,5秒钟后该线程将自动删除\n");
printf("现在输出该线程函数传递的两个参数:\n");
int intValue=((*myType)lpvoid)->firstArgu;
long longValue=((*myType)lpvoid)->secArgu;
printf("firstArgu=%d,secArgu=%ld\n",intValue,longValue);
printf("请等待……\n");
return(0);
}