错误 C2027:使用未定义的类型 GUITHREADINFO

发布于 2024-11-12 05:57:14 字数 1741 浏览 4 评论 0原文

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

同尘 2024-11-19 05:57:14

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文