Find position to a control on an external windows form vb.net
Posted on 2013-12-06
Hey guys... I have a set of fields I need to be able to click and set focus to in an external window. Historically I've been able to do this by providing x, y locations to various controls and sending a mouse click to that coordinate. In this particular case the x, y locations could vary due to different monitor types, resolutions, DPI etc.
If I could find a way to find out the controls exact x,y coordinates programatically that would really help my delima. I've seen some examples on how one might accomplish this via c# but I'm not sure how to tackle it in VB.NET.
I've been doing some reading about using PointToScreen and PointToClient but those are within 'control' objects. I have the windows handles of the controls I'm interested in but I'm not sure how to use that handle and create a control object. Any help (kick in the right direction) would be greatly appreciated.