我在vc里用这个函数建立一个线程代码如下:
#include<windows.h>
#include<iostream.h>
DWORD WINAPI ThreadFunc()
{
MessageBox(NULL,"this is a test","Test",MB_OK);
return 0;
}
int main()
{
HANDLE hThread=NULL;
DWORD ThreadNum=0;
hThread=CreateThread(NULL,NULL,ThreadFunc,0,NULL,&ThreadNum);
return 0;
}
编译器总说我的第三个参数不对,'CreateThread' : cannot convert parameter 3 from 'unsigned long (void)' to 'unsigned long (__stdcall *)(void *)'None of the functions with this name in scope match the target type
我看书上也是这样调用的呀,迷茫??是那里错了呢?
Routine Required header Compatibility
_beginthread
<process.h>
Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003
_beginthreadex
<process.h>
Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003
For more compatibility information, see Compatibility in the Introduction