--- tkWinWm.c.original	2007-06-10 02:15:36.000000000 +0200
+++ tk8.4.16/win/tkWinWm.c	2007-12-08 21:36:16.382515800 +0100
@@ -7406,7 +7406,36 @@
 	    oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
 	    break;
 
-	case WM_ACTIVATE:
+        case WM_SYSCOMMAND:
+          winPtr = GetTopLevel(hwnd);
+          if (winPtr && TkGrabState(winPtr) == TK_GRAB_EXCLUDED) {
+            result = 0;
+            goto done;
+          }
+          else if ( winPtr && winPtr == winPtr->dispPtr->grabWinPtr ) {
+            switch (wParam) {
+              case SC_MINIMIZE:
+                result = 0;
+                goto done;
+            }
+          }
+          break;
+
+        case WM_ACTIVATE: {
+          ActivateEvent *eventPtr;
+          if( (short)wParam == WA_ACTIVE ) {
+            winPtr = GetTopLevel(hwnd);
+            if (winPtr && TkGrabState(winPtr) == TK_GRAB_EXCLUDED) {
+              eventPtr = (ActivateEvent *)ckalloc(sizeof(ActivateEvent));
+              eventPtr->ev.proc = ActivateWindow;
+              eventPtr->winPtr = winPtr;
+              Tcl_QueueEvent((Tcl_Event*)eventPtr, TCL_QUEUE_TAIL);
+              result = 0;
+              goto done;
+            }
+          }
+        }
+          
 	case WM_EXITSIZEMOVE:
 	    if (inMoveSize) {
 		inMoveSize = 0;
