Message board for the users of flat assembler.
> Examples and Tutorials > Center MessageBox in Parent Window, Win64
Who (besides Microsoft) doesn't want to center MessageBox's on the Window generating them?
I'm watch a movie on my primary monitor, and working on the secondary. "Beep!" WTF? My application appears to be frozen. Searching all over the screens. Thinking, "What stopped, huh?" Then under my movie is a MessageBox. Or, worse - hitting enter and not knowing what caused the MessageBox.
Clearly, there are times when MessageBox's don't logically result from a user's action. Yet, if the user is focused on your application and has caused an error/alert by their action, then the MessageBox should be put at their point of focus. It's just good UI design and respectful to the user.
Here is the routine that lets you do that, a CBT Hook which is only momentarily active. Simply replace:
...and include this code: