Search code examples
c++visual-studio-2010undefinedhwnd

error C2027: use of undefined type GUITHREADINFO


during build with Visual Studio C++ I get this error:

error C2027: use of undefined type 'rectAnalyzer::GUITHREADINFO'

the function rectAnalyzer is the following:

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;
}

I've included also WinUser.h or Windows.h but with no result.


Solution

  • Try using sizeof(GUITHREADINFO) instead of sizeof(struct GUITHREADINFO)