[Solved] Win32 API hook implemenation problem.



  • Dear all,

    I write an application to use with win32 keyboard hook implementation in pure Qt not using external dll.
    I face a problem with GetKeyState function. In Visual Studio, it can achieve with like that

    @BYTE keys[256];
    GetKeyboardState(keys); //WINUSERAPI SHORT WINAPI GetKeyState(int); @

    But when I try it in Qt, return error like that,
    @BYTE keys;
    keys = new BYTE[256];
    GetKeyState(keys);
    // error: invalid conversion from 'BYTE
    ' to 'int'@

    Is GetKeyState(int) need to examine all 256 keys?
    How can I solve that problem?

    Thanks


  • Moderators

    You are using two different functions in your example. The first one is using
    GetKeyboardState
    the second one is using
    GetKeyState

    GetKeyboardState is using a pointer to bytes and GetKeyState is having an int as argument.



  • Yes,

    Sorry, I use wrong function. :D
    I solve it..
    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.