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. Intercept button click in another application
Forum Updated to NodeBB v4.3 + New Features

Intercept button click in another application

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.9k 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.
  • L Offline
    L Offline
    lonfort
    wrote on 30 Jul 2014, 17:08 last edited by
    #1

    Hi,

    The task is: run my code when some button was clicked in another application, let it be calculator.exe
    Programming language: Qt 5, but Delphi/C/C++ examples will be ok (because of possible using WinAPI).
    OS: Windows

    After some thinking I have two decisions:

    1. Install global dll hook on mouse button click events in calculator window. Create rectangular area that contains necessary button. When mouse button is clicked, check if we get into this area and then run code.

    2. Find necessary button (I don't know how yet), substitute window procedure to my own (subclassing), make dll injection (VirtualAllocEx, CreateRemoteThread) with my code that will run if button was clicked.

    First way is rough, of course. But window size doesn't change, that's why we need only consider possible window position. Second one is more accurate, but after using Google I have mess in my head about WinAPi, dll, etc. and I don't understand right sequence of actions.

    What could you recommend (and maybe another decisions)?

    Thanks.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 30 Jul 2014, 21:13 last edited by
      #2

      Hi,

      From the looks of it, you are writing a spyware. What is your exact purpose ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lonfort
        wrote on 31 Jul 2014, 09:32 last edited by
        #3

        [quote author="SGaist" date="1406754781"]Hi,

        From the looks of it, you are writing a spyware. What is your exact purpose ?[/quote]

        Well, my customer wants to run external applications (scanning, printing, calculator and others) directly from Microsoft Word (at that 2003 version). VBA and macros aren't allowed to use. It's possible to add custom menus to Word, but I don't exactly know how can I intercept mouse click on this menu. I tried WinSpy++ and similar apps, they could find handles for menubars, but not for separate buttons.

        1 Reply Last reply
        0

        1/3

        30 Jul 2014, 17:08

        • Login

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