I implemented it now using an internal timer that polls for that, since it was the least invasive and works in all cases, including other process hwnd. Hooks wouldn't be able to do that, and are also more invasive IMO. I'm hoping for better ideas, though.
Yeah, I hope for a better solution as well and I don't have suggestion off top of my head. Is there is a real application that actually needs it (and for which a stub is not enough)?