Reputation: 1444
I'm creating a log system ('outside' the application) that logs all the click on the application. I have setup a PreFilterMessage
function wich detects a click from the mouse, but I can't find the control/element that was clicked.
I've tried with Mouse.DirectlyOver
but the element is always null
.
I've tried also with VisualTreeHelper.HitTest
but I don't have a Visual
to make the search from.
I don't have access to the inside of the application: only to the Main method (with the Application.Run(new MainForm());
and my Application.AddMessageFilter(new Logger());
).
Does anyone have an idea (or a walk around) on how to get the clicked control in the application (in .Net 3.5)?
Upvotes: 0
Views: 677
Reputation: 6466
I've been using an amazing little application called Snoop for some time now that I think does exactly what you're after, it's open source (C#) and may be of use to you if you can find out how it works. (All WPF developers should get this and no I don't work on Snoop lol)
Upvotes: 3