Index: trunk/gotcha.cpp
===================================================================
--- trunk/gotcha.cpp	(revision 92)
+++ trunk/gotcha.cpp	(revision 94)
@@ -92,4 +92,10 @@
             g_usePMps = TRUE;
         }
+        if (stricmp (argv[i], "-i") == 0)
+        {
+            g_installer = TRUE;
+            pset->SetFileSaveStyle (FSS_NUMFILES);
+            pset->SetNumSaveDir ("Z:\\");
+        }
 #endif
     }
@@ -113,41 +119,8 @@
     hab = WinInitialize (0);
     HMQ hmq = WinCreateMsgQueue (hab, 0);
+    int rc;
 
     // Load settings moved up here so the string table is available for the already running error
     pset = new SETTINGS;
-    //DisplayError("DEBUG", "%d", Version());
-#ifdef _QUIET_
-    if ((Version() < 2))
-    {
-        DisplayError(RSTR (IDS_ERROR_DLLOUTDATED),
-                     RSTR (IDS_ERROR_DLLOUTDATEDMSG));
-        exit (0);
-    }
-    int rc;
-    HMTX    hmtx     = NULLHANDLE;
-    // running multiple instances orphans all but the first hook unloaded
-    rc = DosOpenMutexSem("\\SEM32\\GOTCHA", &hmtx);
-    if (!rc) { 
-        DisplayError(RSTR (IDS_ERROR_ALREADYRUNNING),
-                     RSTR (IDS_ERROR_ALREADYRUNNINGMSG));
-        exit (0);
-    }
-    rc = DosCreateMutexSem("\\SEM32\\GOTCHA", &hmtx, 0, FALSE);
-    if (rc) {
-        DisplayError(RSTR (IDS_ERROR_SEMAPHOREFAILED),
-                     RSTR (IDS_ERROR_SEMAPHOREFAILEDMSG));
-        exit (0);
-    }
-#endif
-
-    // register our window classes
-    WinRegisterClass (hab, "thth.wc.gotcha.main", WindowProcedure, 0L,
-                      sizeof (ULONG)*2L);
-#ifndef _QUIET_
-    WinRegisterClass (hab, "thth.wc.gotcha.snapshot", wpSnapshot,
-                      CS_SIZEREDRAW, sizeof (ULONG)*2L);
-#endif
-    // load the settings
-    //pset = new SETTINGS;
 
     pset->idleSetInIni = pset->QueryFlag(SEI_IDLEPRIORITY);
@@ -156,5 +129,88 @@
     pset->pForceSaveFile = pset->QueryForceSaveFile();
     pset->bSerialCapture = pset->SerialCapture ();
-#ifndef _QUIET_
+    //DisplayError("DEBUG", "%d", Version());
+#if 0
+#ifdef _QUIET_
+    HINI hini = PrfOpenProfile (hab, "gotchaq.ini");
+#else
+    HINI hini = PrfOpenProfile (hab, "gotcha.ini");
+#endif
+    BOOL fLChange = FALSE;
+    ULONG ulDataSize;
+    PrfQueryProfileSize(hini, "Language", "LangChangeRequested", &ulDataSize );
+    PrfQueryProfileData(hini, "Language", "LangChangeRequested", &fLChange, &ulDataSize);
+    if (!fLChange) {
+    CHAR *lang = getenv("LANG");
+#ifdef _QUIET_
+    PSZ  psz = "goqresen";
+#else
+    PSZ  psz = "gotresen";
+#endif
+    PSZ  pszh = "gotcha_en";
+    if (lang) {
+        if (!strnicmp(lang, "es", 2)) {
+            psz = "gotreses";
+            pszh = "gotcha_es";
+        }
+        else if (!strnicmp(lang, "cs", 2)) {
+            psz = "gotrescz";
+        }
+        else if (!strnicmp(lang, "de", 2)) {
+            psz = "gotresde";
+        }
+        else if (!strnicmp(lang, "it", 2)) {
+            psz = "gotresit";
+            pszh = "gotcha_it";
+        }
+        else if (!strnicmp(lang, "br", 2)) {
+            psz = "gotresbr";
+            pszh = "gotcha_br";
+        }
+    }
+    pset->SetString(SEI_LANGUAGE, psz);
+    pset->SetString (SEI_LANGUAGEHELP, pszh);
+
+    pset->Save ();
+    pset->ReloadResources (pset->QueryString(SEI_LANGUAGE));
+    //fLChange = FALSE;
+        //PrfWriteProfileData(hini, "Language", "LangChangeRequested", &fLChange, sizeof(BOOL));
+    }
+    if (hini)
+        PrfCloseProfile (hini);
+#endif
+#ifdef _QUIET_
+    CheckCmdlineArgs (argc, argv);
+    if ((Version() < 2))
+    {
+        if (! g_installer)
+            DisplayError(RSTR (IDS_ERROR_DLLOUTDATED),
+                         RSTR (IDS_ERROR_DLLOUTDATEDMSG));
+        exit (0);
+    }
+    HMTX    hmtx     = NULLHANDLE;
+    // running multiple instances orphans all but the first hook unloaded
+    rc = DosOpenMutexSem("\\SEM32\\GOTCHA", &hmtx);
+    if (!rc) { 
+        if (! g_installer)
+            DisplayError(RSTR (IDS_ERROR_ALREADYRUNNING),
+                         RSTR (IDS_ERROR_ALREADYRUNNINGMSG));
+        exit (0);
+    }
+    rc = DosCreateMutexSem("\\SEM32\\GOTCHA", &hmtx, 0, FALSE);
+    if (rc) {
+        if (! g_installer)
+            DisplayError(RSTR (IDS_ERROR_SEMAPHOREFAILED),
+                         RSTR (IDS_ERROR_SEMAPHOREFAILEDMSG));
+        exit (0);
+    }
+#endif
+
+    // register our window classes
+    WinRegisterClass (hab, "thth.wc.gotcha.main", WindowProcedure, 0L,
+                      sizeof (ULONG)*2L);
+#ifndef _QUIET_
+    WinRegisterClass (hab, "thth.wc.gotcha.snapshot", wpSnapshot,
+                      CS_SIZEREDRAW, sizeof (ULONG)*2L);
+
     // check cmd line args and if "-a" found take screenshot and exit
     if (CheckCmdlineArgs (argc, argv))
@@ -210,5 +266,4 @@
                      0,0, 0,0, SWP_SHOW);
 #endif
-
     g_phelp = new Helper(hwndFrame);
 
