Solved

Grabbing Button Presses

Posted on 1998-06-09
7
172 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Implementing a ResolveEventHandler in C++ 13 116
Handle Exceptions during instantiation 28 411
How to programmatically differentiate between C and Java 10 188
Dialogbox API leak? 18 81
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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…
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 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.

895 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