Index: trunk/gotcha.cpp
===================================================================
--- trunk/gotcha.cpp	(revision 13)
+++ trunk/gotcha.cpp	(revision 27)
@@ -34,5 +34,5 @@
 PFNWP       OldFrameWP, wpOldButton;
 PSETTINGS   pset;
-BOOL        g_fQuiet = FALSE;
+BOOL        g_fQuiet = FALSE, g_fIdle = FALSE, g_fSetPathName = FALSE;
 HWND        g_hwndMenuSSW;
 HMODULE     g_hmod = NULLHANDLE;
@@ -44,5 +44,5 @@
 #include "savebmp.cpp"
 
-// ** CheckCmdlineArgs **************************************************** /*fold00*/
+// ** CheckCmdlineArgs **************************************************** /*FOLD00*/
 
 BOOL CheckCmdlineArgs (int argc, char *argv[])
@@ -72,4 +72,5 @@
                     pset->SetFileSaveStyle (FSS_NUMFILES);
                     pset->SetNumSaveDir (argv[i]);
+                    g_fSetPathName = TRUE;
                 }
         }
@@ -82,4 +83,5 @@
                 pset->SetFileSaveStyle (FSS_FORCEFILE);
                 pset->SetForceSaveFile (argv[i]);
+                g_fSetPathName = TRUE;
             }
         }
@@ -87,4 +89,5 @@
         else if (stricmp (argv[i], "-i") == 0)
         {
+            g_fIdle = TRUE;
             pset->SetFlag (SEI_IDLEPRIORITY, TRUE);
         }
@@ -111,6 +114,6 @@
 
     //DisplayError("DEBUG", "%d", Version());
-#ifdef _USEDLL_
-    if (g_fQuiet && (Version() < 1))
+//#ifdef _USEDLL_ //_QUIET_
+    if ((Version() < 1))
     {
         DisplayError("GOTCHA.DLL TO OLD",
@@ -123,5 +126,19 @@
         exit (0);
     }
-#endif
+    bool fPrtScr = FALSE;
+    ULONG ulDataSize;
+    int rc;
+
+    rc = PrfQueryProfileSize( HINI_PROFILE, "PM_ControlPanel", "PrintScreen",
+                             &ulDataSize );
+    rc = PrfQueryProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
+                             &fPrtScr, &ulDataSize);
+    if (fPrtScr || !rc) {
+        fPrtScr = TRUE;
+        bool temp = FALSE;
+        rc = PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
+                                 &temp, sizeof(bool));
+    }
+//#endif
 
     // register our window classes
@@ -134,8 +151,14 @@
     pset = new SETTINGS;
 
+    pset->idleSetInIni = pset->QueryFlag(SEI_IDLEPRIORITY);
+    pset->saveStyle = pset->QuerySaveStyle ();
+    pset->pNumSaveDir = pset->QueryNumSaveDir ();
+    pset->pForceSaveFile = pset->QueryForceSaveFile();
+    pset->bSerialCapture = pset->SerialCapture ();
     // check cmd line args and if "-a" found take screenshot and exit
     if (CheckCmdlineArgs (argc, argv))
     {
         CaptureWindow (HWND_DESKTOP, HWND_DESKTOP, NULL, TRUE);
+        pset->SetFileSaveStyle(pset->saveStyle);
         delete pset;
         WinDestroyMsgQueue (hmq);
@@ -159,17 +182,19 @@
 
     // init the quiet mode
-    if (g_fQuiet)
-    {
-#ifdef _USEDLL_
+    //if (g_fQuiet)
+    //{
+#ifdef _USEDLL_   //_QUIET_
         InitDLL (hab, hwndFrame);
         StartInputHook ();
 #endif
 
-        CHAR ach[61];
-        WinQueryWindowText (hwndFrame, sizeof (ach), ach);
-        strcat (ach, RSTR (IDS_QUIETMODE));
-        WinSetWindowText (hwndFrame, ach);
-        WinSetWindowPos (hwndFrame, NULLHANDLE, 0,0, 0,0, SWP_MINIMIZE);
-    }
+        //CHAR ach[61];
+        //WinQueryWindowText (hwndFrame, sizeof (ach), ach);
+        //strcat (ach, RSTR (IDS_QUIETMODE));
+        //WinSetWindowText (hwndFrame, ach);
+        //WinSetWindowPos (hwndFrame, NULLHANDLE, 0,0, 0,0, SWP_MINIMIZE);
+        //HSWITCH hswitch = WinQuerySwitchHandle(hwndFrame, 0);
+        //WinRemoveSwitchEntry(hswitch);
+    //}
 
     // position snapshot window
@@ -196,4 +221,19 @@
         WinDispatchMsg (hab, &qmsg);
 
+
+    // Set priorty to unless user set regular since running -q sets it to idle in the ini
+    if (g_fIdle || g_fQuiet) {
+        pset->SetFlag (SEI_IDLEPRIORITY, pset->idleSetInIni);
+        if (g_fQuiet) {
+            pset->SetFileSaveStyle (pset->saveStyle); // changed with -q
+            pset->SerialCapture (pset->bSerialCapture); // changed with -q
+        }
+    }
+    // Don't change the ini stored paths if the paths were set from the command line
+    if (g_fSetPathName) {
+        pset->SetFileSaveStyle(pset->saveStyle);
+        pset->SetForceSaveFile (pset->pForceSaveFile);
+        pset->SetNumSaveDir (pset->pNumSaveDir);
+    }
     // save size, etc. of snapshot window
     WinQueryWindowPos (hwndSnapshot, &swp);
@@ -208,6 +248,10 @@
     WinDestroyWindow (hwndFrame);
 
-#ifdef _USEDLL_
-    if (g_fQuiet)
+#ifdef _USEDLL_ //_QUIET_
+    if (fPrtScr || !rc) {
+        PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
+                            &fPrtScr, sizeof(bool));
+    }
+    //if (g_fQuiet)
         StopInputHook ();
 #endif
@@ -242,5 +286,54 @@
 }
 
-// ** AddSysMenuItem ****************************************************** /*fold00*/
+APIRET saymsg2(int DefaultButton, HWND hwnd,  PCSZ pszTitle, PCSZ pszFmt, ...)
+{
+  ULONG i;
+  APIRET rc;
+  CHAR szMsg[4096];
+  va_list va;
+  MB2INFO *pmbInfo;
+  MB2D mb2dBut[3];
+  ULONG ulInfoSize = (sizeof(MB2INFO) + (sizeof(MB2D) * 2));
+
+  va_start(va, pszFmt);
+  szMsg[sizeof(szMsg) - 1] = 0;
+  vsprintf(szMsg, pszFmt, va);
+  va_end(va);
+
+  if (szMsg[sizeof(szMsg) - 1]) {
+    fprintf(stderr, "Buffer overflow in saymsg2 - need %u bytes\n", strlen(szMsg) + 1);
+    fflush(stderr);
+  }
+
+  memset(mb2dBut, 0, sizeof(MB2D) * 3);
+  strcpy(mb2dBut[0].achText,"Ok");
+  strcpy(mb2dBut[1].achText,"Cancel");
+  strcpy(mb2dBut[2].achText,"Settings");
+  mb2dBut[0].idButton = 1;
+  mb2dBut[1].idButton = 2;
+  mb2dBut[2].idButton = 3;
+  if (DefaultButton)
+    mb2dBut[DefaultButton - 1].flStyle = BS_DEFAULT;
+  pmbInfo = (MB2INFO *) malloc(ulInfoSize);
+  memset(pmbInfo, 0, ulInfoSize);
+  if (pmbInfo) {
+    pmbInfo->cb		= ulInfoSize;
+    pmbInfo->hIcon      = 0;
+    pmbInfo->cButtons   = 3;
+    pmbInfo->flStyle    = MB_MOVEABLE | MB_ICONQUESTION ;
+    pmbInfo->hwndNotify = NULLHANDLE;
+    for (i = 0; i < 3; i++) {
+      memcpy( pmbInfo->mb2d+i , mb2dBut+i , sizeof(MB2D));
+    }
+    rc = WinMessageBox2(HWND_DESKTOP, hwnd,
+			szMsg, pszTitle, SM2_DIALOG,
+                        pmbInfo);
+    WinSetFocus(HWND_DESKTOP, SM2_DIALOG);
+    free(pmbInfo);
+    return rc;
+  }
+  return MBID_ERROR;
+}
+// ** AddSysMenuItem ****************************************************** /*FOLD00*/
 
 VOID AddSysMenuItem (HWND hwndFrame, MENUITEM *Item, PSZ Text)
@@ -273,8 +366,12 @@
 VOID SetIdlePriority (BOOL f)
 {
+#if 0 //#ifndef _QUEIT_
     if (f)
         DosSetPriority(PRTYS_PROCESS, PRTYC_IDLETIME, 0, 0);
     else
         DosSetPriority(PRTYS_PROCESS, PRTYC_REGULAR, 0, 0);
+#else
+    DosSetPriority(PRTYS_PROCESS, PRTYC_FOREGROUNDSERVER, 0, 0);
+#endif
 }
 
