Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Grabbing Button Presses

Posted on 1998-06-09
7
Medium Priority
?
180 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
nietod earned 300 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

783 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