2
好傢伙處理,這是我的代碼WaitForSingleObject的:如何從_beginthreadex
#include "StdAfx.h"
#include <iostream>
#include <windows.h>
#include <process.h>
unsigned int __stdcall threadproc(void* lparam)
{
std::cout << "my thread" << std::endl;
return 0;
}
int main()
{
unsigned uiThread1ID = 0;
uintptr_t th = _beginthreadex(NULL, 0, threadproc, NULL, 0, &uiThread1ID);
WaitForSingleObject(th, INFINITE/*optional timeout, in ms*/);
return 0;
}
,但我得到了以下錯誤消息
錯誤C2664:「WaitForSingleObject的」:無法從「uintptr_t的」轉換參數1到'HANDLE'
有人能幫我嗎?
只投中將_beginthreadex的值返回(HANDLE)。 –