It's been quite a while since I've used Win32::GUI and you're trying to do something that I have not tried doing before. Looking at the common events documentation for the Win32::GUI module, here's a few untested ideas:
- Use the MouseOver event to detect when the mouse is over the desired window object to trigger your code to get the mouse position.
- Use the MouseMove event to detect when the mouse moves, which in turn triggers your mouse position code.
- Use one of the click related events so that a mouse click is what triggers your code to get the mouse position.
- I'm not sure that I like this idea, but you might even be able to use a Win32::GUI::Timer object to trigger your mouse position code at a set interval.