Results 1 to 3 of 3

Thread: Capture keyboard by hiden Widget and print text into text cursor

  1. #1
    Join Date
    Oct 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Capture keyboard by hiden Widget and print text into text cursor

    Hi all,

    I've developped an widget application in QT. For now, I'm compiling for windows and I intend to compile for linux in the future.

    So, my widget always stays hiden and it has an icon menu for user configuring. What I need to do now is get a keyboard event, manipulate it and then print it into text cursor from windows. For example, if the cursor is on browser url, my programm should get keyboard events, manipulate and print some data into browser url.

    If it was a console, it should get data from stdin and prints something into stdout.

    I've implemented using Keyboard event. Something like http://www.qtcentre.org/threads/4515...t-being-called

    The problem is: this only woks if the widget is active, not hiden.

    I though in using this: http://qt-project.org/doc/qt-4.8/eventsandfilters.html

    For sending data is the "same" problem, the widget is not active, so, how to put data to cursor text? Shall I use QTextCursor (http://qt-project.org/doc/qt-4.8/qtextcursor.html)? I've tried something, without success.

    Shall I use a thread?

    Does anybody can help with this issue?

    Thanks!

  2. #2
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Capture keyboard by hiden Widget and print text into text cursor

    Sounds like you are trying to program a keylogger. Qt key stroke events are not going to help. You need to find out how to intercept the keyboard input at OS level. There is probably a native windows interface for that. Perhaps you can configure an existing keylogger for your needs.

  3. #3
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Capture keyboard by hiden Widget and print text into text cursor

    Shall I use a thread?
    No.
    Does anybody can help with this issue?
    I think "grabing" keyboard input is the only thing Qt can do for you, see: http://qt-project.org/doc/qt-5/qwidg...l#grabKeyboard
    Hence Qt can't help you if you want to write a key logger. If you want to log keys, have a look at the source code of other key logger applications.

Similar Threads

  1. Replies: 4
    Last Post: 12th December 2011, 07:32
  2. Capture text from changeable source (regex)
    By Alir3z4 in forum Newbie
    Replies: 3
    Last Post: 5th December 2011, 17:19
  3. Replies: 0
    Last Post: 23rd February 2011, 16:36
  4. Replies: 11
    Last Post: 5th June 2007, 09:06
  5. How to synchronize text cursor and cursor in QTextEdit
    By kennyxing in forum Qt Programming
    Replies: 6
    Last Post: 18th February 2007, 09:14

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.