msgbox.c patch

Andreas Mohr a.mohr at mailto.de
Fri Apr 13 14:04:09 CDT 2001


[resent because WineHQ refused to accept the mail once again :-(((]

Hi all,

with Log/IC 2, I had the problem that a MessageBox on startup
was hidden, so I couldn't even start the program.
I soon found out that the MessageBox had the MB_TASKMODAL style,
but that *all* MB_*MODAL styles weren't handled at all in Wine !

So I decided to add preliminary support for that.
It's not perfect at all, but at least it works somewhat or warns of potential
problems instead of silently going haywire.

This might fix the problem with the initial "continue install" MessageBox
of an InstallShield installer hidden behind the background in managed mode,
too.
(not tested as I don't know any more which exact installer had this problem)

Andreas Mohr
-------------- next part --------------
--- windows/msgbox.c.org	Fri Apr 13 19:14:18 2001
+++ windows/msgbox.c	Wed Apr 11 21:55:07 2001
@@ -180,7 +180,7 @@
     /* Resize the window */
     SetWindowPos(hwnd, 0, 0, 0, wwidth, wheight,
 		 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
-    
+
     /* Position the icon */
     SetWindowPos(GetDlgItem(hwnd, MSGBOX_IDICON), 0, ileft, (tiheight - iheight) / 2, 0, 0,
 		 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
@@ -204,6 +204,23 @@
 	    bpos += bw + bspace;
 	}
     }
+
+    /* handle modal MessageBoxes */
+    if (lpmb->dwStyle & (MB_TASKMODAL|MB_SYSTEMMODAL))
+    {
+	FIXME("%s modal msgbox ! Not modal yet.\n",
+		lpmb->dwStyle & MB_TASKMODAL ? "task" : "system");
+	/* Probably do EnumTaskWindows etc. here for TASKMODAL
+	 * and work your way up to the top - I'm lazy (HWND_TOP) */
+	SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
+			SWP_NOSIZE | SWP_NOMOVE);
+	if (lpmb->dwStyle & MB_TASKMODAL)
+	    /* at least MB_TASKMODAL seems to imply a ShowWindow */
+	    ShowWindow(hwnd, SW_SHOW);
+    }
+    if (lpmb->dwStyle & MB_APPLMODAL)
+	FIXME("app modal msgbox ! Not modal yet.\n");
+    
     return hFont;
 }
 
@@ -240,7 +257,7 @@
 
    default:
      /* Ok. Ignore all the other messages */
-     TRACE("Message number %i is being ignored.\n", message);
+     TRACE("Message number 0x%04x is being ignored.\n", message);
     break;
   }
   return 0;


More information about the wine-patches mailing list