在使用Visual Studio C ++构建期间,我收到此错误:
error C2027: use of undefined type 'rectAnalyzer::GUITHREADINFO'
函数rectAnalyzer如下:
DWORD WINAPI rectAnalyzer(LPVOID param)
{
MSG msg;
PARAM_PASSED *p = (PARAM_PASSED*) param;
std::ostringstream ss;
std::wstring str;
PGUITHREADINFO g = (PGUITHREADINFO) malloc(sizeof(struct GUITHREADINFO));
if(p)
{
ss << "rectAnalyzer: entering thread " << p->index << "->" << p->parentThreadId << std::endl;
str = string2wideString(ss.str().c_str());
OutputDebugString(str.c_str());
PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
if(WaitForSingleObject(hStartEvent,INFINITE) != WAIT_OBJECT_0)
return 1;
ss << "rectAnalyzer: thread " << p->index << " sending WM_APP" << std::endl;
str = string2wideString(ss.str().c_str());
OutputDebugString(str.c_str());
if(!GetGUIThreadInfo(p->parentThreadId, g))
{
ss << "rectAnalyzer: unable to get GUI thread info" << std::endl;
str = string2wideString(ss.str().c_str());
OutputDebugString(str.c_str());
}
while(!PostMessage(g->hwndActive, WM_APP, (WPARAM) 0, (LPARAM) 0))
{
ss << "rectAnalyzer: thread " << p->index << " unable to send WM_APP" << std::endl;
str = string2wideString(ss.str().c_str());
OutputDebugString(str.c_str());
Sleep(1);
}
free(p);
}
else
{
ss << "rectAnalyzer: cannot get p" << std::endl;
str = string2wideString(ss.str().c_str());
OutputDebugString(str.c_str());
}
return 0;
}
我还包括WinUser.h或Windows.h但没有结果。
答案 0 :(得分:1)
尝试使用sizeof(GUITHREADINFO)
代替sizeof(struct GUITHREADINFO)