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. Qt background service to capture keyboard and mouse activity of user
Forum Updated to NodeBB v4.3 + New Features

Qt background service to capture keyboard and mouse activity of user

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 1.1k Views 2 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
    ZeeshanAsghar
    wrote on last edited by
    #1

    Hi

    I want to write a qt windows desktop application that run in background or in system tray and count user keyboard and mouse activity for detecting activeness or idleness.

    Can this be possible in QT and how ?

    Thanks
    Zeeshan

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      This may be illegal in some countries. Make sure your users will know that such application is running!

      I think it could be done, for example by launching a full-screen, transparent QWidget which will intercept all key strokes and then pass them through. I'd expect such solution to be very buggy, though. Maybe there are some Windows-specific APIs for this, I don't know.

      (Z(:^

      1 Reply Last reply
      3
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        hi
        Windows has global input hooks that can be used for this.
        https://www.geeksforgeeks.org/design-a-keylogger-in-python/

        However, please be aware that all anti-virus software might trigger on your app.

        Also if for purely idle detection maybe GetLastInputInfo can be used

        https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getlastinputinfo?redirectedfrom=MSDN

        1 Reply Last reply
        3
        • F Offline
          F Offline
          fahad64
          wrote on last edited by
          #4

          You will need a global input hook API. As QT is thread specific.

          https://github.com/kwhat/uiohook
          https://github.com/Skycoder42/QHotkey

          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