Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    [Solved] Win32 API hook implemenation problem.

    General and Desktop
    2
    3
    3474
    Loading More Posts
    • 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
      zither last edited by

      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 Reply Quote 0
      • K
        koahnig last edited by

        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 Reply Quote 0
        • Z
          zither last edited by

          Yes,

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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post