Get mouse coordinates relative to control in separate application...
-
Hello, I'm wondering how to go about getting the mouse cursor position relative to a child window in a given windows application. I'm writing an application that is interested in this data. Example: The user clicks a button in some winforms app, and my application uses low level hooks (or some other strategy) to determine the mouse coordinates relative to the clicked button in the other application. Any thoughts on how to proceed? I'm hooking the mouse so I get the screen coordinates when the mouse is clicked, but I'm not sure how to get position (relative or absolute) of the control that generated the "click" event. Thanks!
-
Hello, I'm wondering how to go about getting the mouse cursor position relative to a child window in a given windows application. I'm writing an application that is interested in this data. Example: The user clicks a button in some winforms app, and my application uses low level hooks (or some other strategy) to determine the mouse coordinates relative to the clicked button in the other application. Any thoughts on how to proceed? I'm hooking the mouse so I get the screen coordinates when the mouse is clicked, but I'm not sure how to get position (relative or absolute) of the control that generated the "click" event. Thanks!
You can get screen co-ordinates and do the conversion yourself, it's pretty straightforward, just get the position of the window in question.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
You can get screen co-ordinates and do the conversion yourself, it's pretty straightforward, just get the position of the window in question.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Yeah, I guess my question is really how to get the position of a child window that generated the event (where the child window is running in a separate application from the code that is interested in its position). I see that Spy++ is able to identify the positions of child windows, I just don't know what APIs are being used.