I'm developing an MDI application, the primary document is maximized in the MDI frame. I create a non-modal dialog pop-up to display secondary information to the user while they work in the main window. However, when the user moves the pop-up it takes focus which is expected. The problem occurs when this window has focus and an event which generates an AfxMessageBox occurs in the mainframe. I would expect the AfxMessageBox to pop-up centered on the mainframe. Currently, it pops up centered on the non-modal dialog pop-up window which, by chance, had focus at that time.
Is there a way to force AfxMessageBox to always pop-up centered on the mainframe? Or at least force it to pop-up centered on the window in which it was called. For example, if in my non-modal dialog an error occurs, i would want the AfxMessageBox to appear centered on that dialog because it's intuitive that the error occurred there. Alternatively, if I'm working with the non-modal dialog and an error occurs in the mainframe or document then I would like the AfxMessageBox to appear centered on it's view/frame despite the fact that I'm currently working with the child window.
I hope that's clear enough.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…