c++ - 错误 C2027 : use of undefined type GUITHREADINFO

标签 c++ visual-studio-2010 undefined hwnd

在使用 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 但没有结果。

最佳答案

尝试使用 sizeof(GUITHREADINFO) 而不是 sizeof(struct GUITHREADINFO)

关于c++ - 错误 C2027 : use of undefined type GUITHREADINFO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6212009/

相关文章:

undefined - 摩纳哥 registerSignatureHelpProvider() 导致错误 : Cannot read property 'signatures' of undefined

javascript - node.js 在控制台显示 "undefined"

c++ - 我的小部件没有显示在主窗口中。 qt

c++ - 为什么对 std::tuple 实现使用递归继承不好?

c# - 如何使用 vs2010 在 Sql Server 2012 中运行 SSIS 包?

.net - Visual Studio 2012 缺少框架

c++ - 删除句柄类中的对象可能会导致未定义的行为

c++ - 如何在 visual studio 2010 中使用 openAl

Jquery Datepicker 在 Visual Studio 中工作,但在部署时不起作用

javascript - 如何检查深层嵌套对象是否未定义?