Brining a window to the foreground

Hi !
I would like it whenever the mouse hovers over a window that isn't in the foreground to bring that window to the foreground. It has to be for any window not just the program's.
What are some functions I should be looking at to do this ?

Thanks !
Last edited on
My first thought is to use SetWindowsHookEx to install a WH_GETMESSAGE hook. From there you can determine which window the mouse is over and then call SetWindowPos to bring it to the foreground.

SetWindowsHookEx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990%28v=vs.85%29.aspx

SetWindowPos
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx
Last edited on
Thanks knn9.
Do you know of a simple example showing how a global hook works ?
The MSDN explanation is a little heavy for me.

Would SetWindowPos be better than ShowWindow for the purpose I mentioned ?
Topic archived. No new replies allowed.