Important: Please read the Qt Code of Conduct -

[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];
    // error: invalid conversion from 'BYTE
    ' to 'int'@

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


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

    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..

Log in to reply