Click here to Skip to main content
15,886,199 members

Cursor position relative to active program window

Revision 3
Hello,

I am writing an application in VB express 2010. I need to be able to bring focus to a running application window, which is NOT part of the program and get the cursor co-ordinates relative and within the bounds of that window only. Both the running program and the application window need to both be visible.

For instance I might have the VB program running and then open Windows Media Player. I should then be able to get the mouse coordinates of say the pause button relative to the player, so wherever the player is on the screen, these coordinates will always be the same. The player is just an example, it could be ANY active program window - I would need to be able to choose the active window and set focus to that.

I can use cursor.position.(X/Y) to get the coordinates of the cursor anywhere on the screen but I need it relative to the active program window.

Many thanks
Matt
Posted 8-Oct-12 15:04pm by kalora.
Tags: ,