Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Solved] Missing WinApi function



  • Maybe this isnt pure QT related problem, but i cant find out whats wrong
    i have a main.cpp file, where are, among the others, these header files included
    @#include <windows.h>
    #include <winuser.h>
    @
    then, in a callback function there is this piece of code

    @GUITHREADINFO info;
    info.cbSize = sizeof(GUITHREADINFO);
    if(GetGUIThreadInfo(0, &info))
    {
    //some action
    }@

    when i try to build this, i get this error

    bq.
    main.cpp:116: error: 'GUITHREADINFO' was not declared in this scope
    main.cpp:116: error: expected ';' before 'info'
    main.cpp:117: error: 'info' was not declared in this scope
    main.cpp:193: error: 'GetGUIThreadInfo' was not declared in this scope

    ive checked header file and i found this line
    C:\QtSDK\mingw\include\winuser.h
    @#if (WINVER >= 0x0500)
    WINUSERAPI BOOL WINAPI GetGUIThreadInfo(DWORD,LPGUITHREADINFO);
    #endif@

    so i really dont get this behavious, any help apprecieted
    AndyC

    //well, ive solved the problem just after i posted it :)
    for some strange reason, i found out, that in the windef.h file was WINVER defined as 0x0400
    so i simply had to redefined it before including ani window header file to some higher value, and problem is solved :)


  • Moderators

    Add [Solved] to the thread's subject, then. It took me some time to read the whole post just to find the note at the end.


Log in to reply