Index: trunk/mainwin.cpp
===================================================================
--- trunk/mainwin.cpp	(revision 41)
+++ trunk/mainwin.cpp	(revision 51)
@@ -159,9 +159,14 @@
     switch (msg)
     {
+#ifndef _QUIET_
     case WM_CREATE:
+#else
+    case WM_INITDLG:
+#endif
         {
 #ifdef _DOLOGDEBUG_
             LogDebug( "MainWin:WindowProcedure: WM_CREATE" );
 #endif
+#ifndef _QUIET_
             USHORT   usResID = WinQueryWindowUShort (hwnd, QWS_ID);
 
@@ -177,6 +182,17 @@
                              rcl.yTop - rcl.yBottom,
                              SWP_SHOW | SWP_MOVE | SWP_SIZE | SWP_ZORDER);
-        }
+#endif
+        }
+#ifdef _QUIET_
+        WinSendDlgItemMsg (hwnd, WID_CB_HIDEWINDOW, BM_SETCHECK,
+                           MPFROMLONG (TRUE), MPFROMLONG (0));
+        WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
+                           MPFROMLONG (pset->DelayedCapture ()),
+                           MPFROMLONG (0));
+        WinSetFocus( WinWindowFromID (g_hwndPage0, WID_RB_FILE), FALSE );
+        return MRESULT (FALSE);
+#else
         break;
+#endif
 
     case WM_QUIT:
@@ -210,8 +226,9 @@
                                          BM_QUERYCHECK, 0, 0));
             pset->HideWindow (f);
-
+#ifndef _QUIET_
             f = BOOL (WinSendDlgItemMsg (hwnd, WID_CB_DELAYEDCAPTURE,
                                          BM_QUERYCHECK, 0, 0));
             pset->DelayedCapture (f);
+#endif
         }
         return MRESULT (FALSE);
@@ -221,4 +238,5 @@
         return MRESULT (FALSE);
 
+#ifndef _QUIET_
     case WM_PAINT:
         {
@@ -237,4 +255,5 @@
         }
         break;
+#endif
 
     case WM_COMMAND:
@@ -244,7 +263,12 @@
         if (usState != STATE_IDLE)
         {
+            //Attempt to open settings probably a hang
+            if (SHORT1FROMMP (mp1) == WID_PB_SETTINGS) {
+                WinSendMsg (hwnd, UM_ABORT, 0,0);
+                pset->Dialog ();
+            }
             // this means ESC was pressed
-            if (SHORT1FROMMP (mp1) == DID_CANCEL)
-                WinSendMsg (hwnd, UM_ABORT, 0,0);
+            else if (SHORT1FROMMP (mp1) == DID_CANCEL)
+                WinSendMsg (hwnd, UM_ABORT, MPFROMLONG(1),0);
             return MRESULT (FALSE);
         }
@@ -344,5 +368,6 @@
 
         case WID_PB_EXIT:
-            WinSendMsg (hwnd, WM_CLOSE, 0,0);
+            WinSendMsg (WinWindowFromID (hwndFrame, FID_CLIENT),
+                        WM_CLOSE, 0,0);
             break;
 
@@ -371,5 +396,5 @@
 #endif
         }
-        else {
+        /*else {
             SWP     swp;
             CHAR    ach[32] = {0};
@@ -386,5 +411,5 @@
                 return MRESULT (FALSE);
             }
-        }
+        } */
 #ifndef _QUIET_
         if (WinQueryButtonCheckstate (hwnd, WID_CB_HIDEWINDOW)) {
@@ -419,4 +444,7 @@
 
         case CAP_SCREENREGION:
+#ifdef _QUIET_
+            WinSetFocus(HWND_DESKTOP, hwnd);
+#endif
             if (DoTracking (&rcl))
             {
@@ -429,5 +457,5 @@
                                 MPFROMHWND (HWND_DESKTOP));
                 if (rc == 2)
-                    WinSendMsg (hwnd, UM_ABORT, 0,0);
+                    WinSendMsg (hwnd, UM_ABORT, MPFROMLONG(1),0);
                 if (rc == 3) {
                     pset->Dialog ();
@@ -443,4 +471,7 @@
         case CAP_WINDOWINT:
             fInterior = TRUE;
+#ifdef _QUIET_
+            WinSetFocus(HWND_DESKTOP, hwnd);
+#endif
             StartSelection (hwnd);
             break;
@@ -448,4 +479,7 @@
         case CAP_WINDOW:
             fInterior = FALSE;
+#ifdef _QUIET_
+            WinSetFocus(HWND_DESKTOP, hwnd);
+#endif
             StartSelection (hwnd);
             break;
@@ -525,11 +559,10 @@
     case WM_TIMER:
         ulCountdown --;
-
-        if( ulCountdown % 20 == 0 ) {
-            WinSendMsg (hwndSnapshot, UM_COUNTDOWN, MPFROMLONG (ulCountdown), 0);
-
-            if (pset->DelayCountdown () && !pset->SerialCapture ())
-                DoCountdown (ulCountdown);
-        }
+       
+        if( ulCountdown % 20 == 0 )
+            WinSendMsg (hwndSnapshot, UM_COUNTDOWN,
+                        MPFROMLONG (ulCountdown), 0);
+        if (pset->DelayCountdown () && !pset->SerialCapture ())
+            DoCountdown (ulCountdown);
 
         if (ulCountdown == 0)
@@ -593,5 +626,6 @@
 
     case UM_ABORT:
-        DosBeep (75, 200);
+        if (LONGFROMMP(mp1) != 1)
+            DosBeep (75, 200);
         WinSendMsg (hwnd, UM_CLEANUP, 0,0);
         return MRESULT (FALSE);
@@ -631,5 +665,8 @@
     LogDebug( "MainWin:WindowProcedure:WinDefWindowProc->0x%04x", msg );
 #endif
-    return WinDefWindowProc (hwnd, msg, mp1, mp2);
+    if (hwnd ==  g_hwndPage0)
+        return WinDefDlgProc (hwnd, msg, mp1, mp2);
+    else
+        return WinDefWindowProc (hwnd, msg, mp1, mp2);
 }
 
