Solved

Grabbing Button Presses

Posted on 1998-06-09
7
171 Views
Last Modified: 2010-04-10
I need to be able to grab/intercept button clicks from a third party application.  So that I can record them & replay the same sequence at a later time.
0
Comment
Question by:DanielJenkins
  • 5
  • 2
7 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1165503
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165504
You need to use a system hook.  A system hook allows a procedure in a DLL (not EXE) to be notified when various events happen in the system, one of which is mouse clicks (I assume by button you mean mouse button).  

Look at the documentation for SetWindowsHookEx()  This is the function that allows you to create the hook.  If you have any questions after reading the documentation, let me know.
0
 

Author Comment

by:DanielJenkins
ID: 1165505
I have tired using a system hook, but not enough informaion is returned.
I need to be able to track which button has been click either on a toolbar, the mouse, or Menu items.

ie. If someone clicks on the OK, Cancel, Next, or Previous buttons.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1165506
You can use WindowFromPoint() to find the window that was under the mouse.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165507
That gives you the window handle to the window that was clicked.  What you'll do next will depend on what you are actually tryng to do.  (I'm not sure what that is)  I can help you with that, probably, but you have to give me some idea of the goal.  All you asked so far was how to get/intercept the button clicks in another application.  Which I answered, but I'm not sure where you want to go with that.
0
 

Author Comment

by:DanielJenkins
ID: 1165508
I need to be able to record each commands from any application, such as the calculator, and send the commands to another computer and replay the recorded command on the remote computers calculator.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165509
First of all.  You should not accept an answer until you are certain it is complete and going to work.  I remind clients of that often just in case.  But this time I'm saying it because I'm not sure how much more help I can give you.

You are going to have a very hard time "translating" the information from one computer to the other.  You can find out the window handle of the window that was pressed on the local computer, but that can't be used on the remote computer.  There are some possibilities, though.

Do you have any windows that necessarily correspond between the two computers.  Like is there is one paticular application that is being used on both computers and that the information must be translated between, or is this stuff that must work with every window currently present?  (If so what happens when there isn't a corrseponding window?)
Do you know if the windows will be at the same coordinates?  Or what information do you know that is the same between the two computers?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now