Solved

Grabbing Button Presses

Posted on 1998-06-09
7
175 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

829 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