Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Win32 API hook implemenation problem.
Qt 6.11 is out! See what's new in the release blog

[Solved] Win32 API hook implemenation problem.

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zither
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      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.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zither
        wrote on last edited by
        #3

        Yes,

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved