Calculate how many times a button had been clicked (CITRIX application)
-
Thursday, October 07, 2010 10:35 PM
If I am not using the correct forum, please redirect me to the right one.
This is my question:
I have got a project in which I've got Windows computer clients. All of them are running an application (A CITRIX one).
I should configure an application that calculate how many times a user clicked on a certain button in this application.
I don't know how to do that and I would like to ask you if this is feasable and if it can be done using .NET
I never used .NET and in this project I would like to work with Microsoft technologies.
So, can any one tell if that can be done?
If yes, can you explain to me what should I do to do that?
A collegue told me that I can record in a file the windows messages that are generated when the button is clicked. If this can be done, I think that what I want will be done.
Hope this link will help.
http://msdn.microsoft.com/en-us/library/bb775941%28VS.85%29.aspx
- Moved by CoolDadTxMVP, Moderator Friday, October 08, 2010 1:23 PM Not IDE related (From:Visual C# IDE)
All Replies
-
Friday, October 08, 2010 9:34 PM
Someone told me today that this can be done using hooking like this one.
http://www.devsource.com/c/a/Using-VS/Hooking-Windows-Messages-in-NET/
Maybe that help.
-
Saturday, October 16, 2010 7:10 PM
This can be best done via the UI Automation.
To detect when a button in another application is pushed I would look at accessibility events: use UIA to find the button you are interested in tracking and then subscribe to its InvokedEvent to detect when it is pushed.
Here is some useful background information for using UI Automation
UI Automation Overview: http://msdn.microsoft.com/en-us/library/ms747327.aspx
UI Automation Events Overview: http://msdn.microsoft.com/en-us/library/ms748252.aspx
Obtaining UI Automation Elements: http://msdn.microsoft.com/en-us/library/ms752331.aspxThe following two links have code snippets for finding an element (such as the button) and for subscribing to its InvokedEvent respectively:
Find a UI Automation Element Based on a Property Condition: http://msdn.microsoft.com/en-us/library/ms744877.aspx
InvokedEvent: http://msdn.microsoft.com/en-us/library/system.windows.automation.invokepattern.invokedevent.aspxTrying to detect button clicks in other processes this with windows hooks will not work. Because window hooks require running code in the hooked process, managed applications cannot set hooks in other processes. The code at the www.devsource.com link will work only within the caller’s own process.
- Proposed As Answer by billb08 - MSFT Saturday, October 16, 2010 7:13 PM
- Marked As Answer by NETtest2010 Monday, October 18, 2010 8:17 PM
-
Monday, October 18, 2010 8:16 PM
Thanks Billb08.
Looks like this is what I need.
My project will start in January so I will be back if there is other problems.
Regards.
-
Monday, October 18, 2010 8:44 PM
I would like to try what you mentioned on the CALC application (start > run > calc).
I had never developed on .NET, so could you please tell me how to do to use UIA to find the "0" button (just an example: I want to try to track how many times a user clicked on this button)? What should I change in the source code you provided me?
-
Tuesday, November 09, 2010 6:00 PM
This can be best done via the UI Automation.
To detect when a button in another application is pushed I would look at accessibility events: use UIA to find the button you are interested in tracking and then subscribe to its InvokedEvent to detect when it is pushed.
Here is some useful background information for using UI Automation
UI Automation Overview: http://msdn.microsoft.com/en-us/library/ms747327.aspx
UI Automation Events Overview: http://msdn.microsoft.com/en-us/library/ms748252.aspx
Obtaining UI Automation Elements: http://msdn.microsoft.com/en-us/library/ms752331.aspx
The following two links have code snippets for finding an element (such as the button) and for subscribing to its InvokedEvent respectively:
Find a UI Automation Element Based on a Property Condition: http://msdn.microsoft.com/en-us/library/ms744877.aspx
InvokedEvent: http://msdn.microsoft.com/en-us/library/system.windows.automation.invokepattern.invokedevent.aspx
Trying to detect button clicks in other processes this with windows hooks will not work. Because window hooks require running code in the hooked process, managed applications cannot set hooks in other processes. The code at the www.devsource.com link will work only within the caller’s own process.
bill boyce- Proposed As Answer by billb08 - MSFT Tuesday, November 09, 2010 6:01 PM

