2012-10-18 Keith Marshall <keithmarshall@users.sourceforge.net>
+ Associate DMH message boxes with active dialogues.
+
+ * src/guidmh.cpp (last_active_popup): New static inline function.
+ (dmhTypeGUI::dispatch_message): Use it.
+
+2012-10-18 Keith Marshall <keithmarshall@users.sourceforge.net>
+
Fix Diagnostic Message Handler initialisation logic.
* src/dmh.cpp (dmh_init) [DMH_SUBSYSTEM_GUI]: Correct a logic error;
}
}
+static inline HWND last_active_popup( HWND owner )
+{
+ /* Local helper function to ensure that diagnostic MessageBox
+ * dialogues are assigned to the most recently active pop-up,
+ * if any, invoked by the primary owner application window.
+ */
+ HWND popup = GetLastActivePopup( owner );
+ if( IsWindow( popup ) )
+ return popup;
+ return owner;
+}
+
int dmhTypeGUI::dispatch_message( int len )
{
/* Helper used by both the control() and notify() methods,
/* Dispatch the message...
*/
- MessageBox( owner, msgbuf, progname, status );
+ MessageBox( last_active_popup( owner ), msgbuf, progname, status );
/* ...then release the heap memory used to format it.
*/