Changeset 94 for trunk/gotcha.cpp


Ignore:
Timestamp:
Jul 17, 2021, 9:24:00 PM (4 years ago)
Author:
Gregg Young
Message:

Add unicode support; Add -i switch for AOS install to GQ; Remove language selection from GQ; Remove help file lang selection from Gotcha; Clean up and rework dialogs/strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gotcha.cpp

    r92 r94  
    9292            g_usePMps = TRUE;
    9393        }
     94        if (stricmp (argv[i], "-i") == 0)
     95        {
     96            g_installer = TRUE;
     97            pset->SetFileSaveStyle (FSS_NUMFILES);
     98            pset->SetNumSaveDir ("Z:\\");
     99        }
    94100#endif
    95101    }
     
    113119    hab = WinInitialize (0);
    114120    HMQ hmq = WinCreateMsgQueue (hab, 0);
     121    int rc;
    115122
    116123    // Load settings moved up here so the string table is available for the already running error
    117124    pset = new SETTINGS;
    118     //DisplayError("DEBUG", "%d", Version());
    119 #ifdef _QUIET_
    120     if ((Version() < 2))
    121     {
    122         DisplayError(RSTR (IDS_ERROR_DLLOUTDATED),
    123                      RSTR (IDS_ERROR_DLLOUTDATEDMSG));
    124         exit (0);
    125     }
    126     int rc;
    127     HMTX    hmtx     = NULLHANDLE;
    128     // running multiple instances orphans all but the first hook unloaded
    129     rc = DosOpenMutexSem("\\SEM32\\GOTCHA", &hmtx);
    130     if (!rc) {
    131         DisplayError(RSTR (IDS_ERROR_ALREADYRUNNING),
    132                      RSTR (IDS_ERROR_ALREADYRUNNINGMSG));
    133         exit (0);
    134     }
    135     rc = DosCreateMutexSem("\\SEM32\\GOTCHA", &hmtx, 0, FALSE);
    136     if (rc) {
    137         DisplayError(RSTR (IDS_ERROR_SEMAPHOREFAILED),
    138                      RSTR (IDS_ERROR_SEMAPHOREFAILEDMSG));
    139         exit (0);
    140     }
    141 #endif
    142 
    143     // register our window classes
    144     WinRegisterClass (hab, "thth.wc.gotcha.main", WindowProcedure, 0L,
    145                       sizeof (ULONG)*2L);
    146 #ifndef _QUIET_
    147     WinRegisterClass (hab, "thth.wc.gotcha.snapshot", wpSnapshot,
    148                       CS_SIZEREDRAW, sizeof (ULONG)*2L);
    149 #endif
    150     // load the settings
    151     //pset = new SETTINGS;
    152125
    153126    pset->idleSetInIni = pset->QueryFlag(SEI_IDLEPRIORITY);
     
    156129    pset->pForceSaveFile = pset->QueryForceSaveFile();
    157130    pset->bSerialCapture = pset->SerialCapture ();
    158 #ifndef _QUIET_
     131    //DisplayError("DEBUG", "%d", Version());
     132#if 0
     133#ifdef _QUIET_
     134    HINI hini = PrfOpenProfile (hab, "gotchaq.ini");
     135#else
     136    HINI hini = PrfOpenProfile (hab, "gotcha.ini");
     137#endif
     138    BOOL fLChange = FALSE;
     139    ULONG ulDataSize;
     140    PrfQueryProfileSize(hini, "Language", "LangChangeRequested", &ulDataSize );
     141    PrfQueryProfileData(hini, "Language", "LangChangeRequested", &fLChange, &ulDataSize);
     142    if (!fLChange) {
     143    CHAR *lang = getenv("LANG");
     144#ifdef _QUIET_
     145    PSZ  psz = "goqresen";
     146#else
     147    PSZ  psz = "gotresen";
     148#endif
     149    PSZ  pszh = "gotcha_en";
     150    if (lang) {
     151        if (!strnicmp(lang, "es", 2)) {
     152            psz = "gotreses";
     153            pszh = "gotcha_es";
     154        }
     155        else if (!strnicmp(lang, "cs", 2)) {
     156            psz = "gotrescz";
     157        }
     158        else if (!strnicmp(lang, "de", 2)) {
     159            psz = "gotresde";
     160        }
     161        else if (!strnicmp(lang, "it", 2)) {
     162            psz = "gotresit";
     163            pszh = "gotcha_it";
     164        }
     165        else if (!strnicmp(lang, "br", 2)) {
     166            psz = "gotresbr";
     167            pszh = "gotcha_br";
     168        }
     169    }
     170    pset->SetString(SEI_LANGUAGE, psz);
     171    pset->SetString (SEI_LANGUAGEHELP, pszh);
     172
     173    pset->Save ();
     174    pset->ReloadResources (pset->QueryString(SEI_LANGUAGE));
     175    //fLChange = FALSE;
     176        //PrfWriteProfileData(hini, "Language", "LangChangeRequested", &fLChange, sizeof(BOOL));
     177    }
     178    if (hini)
     179        PrfCloseProfile (hini);
     180#endif
     181#ifdef _QUIET_
     182    CheckCmdlineArgs (argc, argv);
     183    if ((Version() < 2))
     184    {
     185        if (! g_installer)
     186            DisplayError(RSTR (IDS_ERROR_DLLOUTDATED),
     187                         RSTR (IDS_ERROR_DLLOUTDATEDMSG));
     188        exit (0);
     189    }
     190    HMTX    hmtx     = NULLHANDLE;
     191    // running multiple instances orphans all but the first hook unloaded
     192    rc = DosOpenMutexSem("\\SEM32\\GOTCHA", &hmtx);
     193    if (!rc) {
     194        if (! g_installer)
     195            DisplayError(RSTR (IDS_ERROR_ALREADYRUNNING),
     196                         RSTR (IDS_ERROR_ALREADYRUNNINGMSG));
     197        exit (0);
     198    }
     199    rc = DosCreateMutexSem("\\SEM32\\GOTCHA", &hmtx, 0, FALSE);
     200    if (rc) {
     201        if (! g_installer)
     202            DisplayError(RSTR (IDS_ERROR_SEMAPHOREFAILED),
     203                         RSTR (IDS_ERROR_SEMAPHOREFAILEDMSG));
     204        exit (0);
     205    }
     206#endif
     207
     208    // register our window classes
     209    WinRegisterClass (hab, "thth.wc.gotcha.main", WindowProcedure, 0L,
     210                      sizeof (ULONG)*2L);
     211#ifndef _QUIET_
     212    WinRegisterClass (hab, "thth.wc.gotcha.snapshot", wpSnapshot,
     213                      CS_SIZEREDRAW, sizeof (ULONG)*2L);
     214
    159215    // check cmd line args and if "-a" found take screenshot and exit
    160216    if (CheckCmdlineArgs (argc, argv))
     
    210266                     0,0, 0,0, SWP_SHOW);
    211267#endif
    212 
    213268    g_phelp = new Helper(hwndFrame);
    214269
Note: See TracChangeset for help on using the changeset viewer.