gpt4 book ai didi

C++ 将 stdcall 函数名作为参数传递

转载 作者:太空宇宙 更新时间:2023-11-04 03:58:23 25 4
gpt4 key购买 nike

我无法将 stdcall 函数名称“TestFunction”作为参数传递给 ExecuteLocalThread 并在 beginthreadex 中使用

unsigned __stdcall TestFunction(void* timerPointer)
{
unsigned result =0;
printf("thread is running\n");
return result;
}

void ExecuteLocalThread(unsigned int (_stdcall *_StartAddress)(void *))
{
HANDLE heartBeatThread;
unsigned int hbThreadID;
heartBeatThread = (HANDLE)_beginthreadex(NULL, 0 , unsigned int (_stdcall *_StartAddress)(void *)/*&TestFunction*/, (void*)this, CREATE_SUSPENDED, &hbThreadID);
ResumeThread( heartBeatThread );
}

最佳答案

尝试:

heartBeatThread = (HANDLE)_beginthreadex(NULL, 0 , _StartAddress/*&TestFunction*/, (void*)this, CREATE_SUSPENDED, &hbThreadID);

关于C++ 将 stdcall 函数名作为参数传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14256837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com