I am trying to track a moving desktop application window so I can move a corresponding transparent overlay window in parity. Currently, I hook the EVENT_SYSTEM_MOVESIZEEND
event with SetWinEventHook
. Inside my callback, I update the location of my overlay with the new location of the target application window.
This works, but it means that my overlay jumps around after the user lets go of the target window's title bar. I would like my overlay to track the target window as it is moving, not just after it has been moved.
The only way I can think to do this is to also hook the EVENT_SYSTEM_MOVESIZESTART
event. When the START
event fires, spawn a new thread that polls the target windows location and updates my overlay location. Then, when the END
event fires, kill the polling thread.
Is this a reasonable approach, or is there a better way to achieve the functionality I want.
Thanks.
WM_WINDOWPOSCHANGING
message. – Remy Lebeau