Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gotcha.cpp

    r30 r13  
    3434PFNWP       OldFrameWP, wpOldButton;
    3535PSETTINGS   pset;
    36 BOOL        g_fQuiet = FALSE, g_fIdle = FALSE, g_fSetPathName = FALSE;
     36BOOL        g_fQuiet = FALSE;
    3737HWND        g_hwndMenuSSW;
    3838HMODULE     g_hmod = NULLHANDLE;
     
    4444#include "savebmp.cpp"
    4545
    46 // ** CheckCmdlineArgs **************************************************** /*FOLD00*/
     46// ** CheckCmdlineArgs **************************************************** /*fold00*/
    4747
    4848BOOL CheckCmdlineArgs (int argc, char *argv[])
     
    7272                    pset->SetFileSaveStyle (FSS_NUMFILES);
    7373                    pset->SetNumSaveDir (argv[i]);
    74                     g_fSetPathName = TRUE;
    7574                }
    7675        }
     
    8382                pset->SetFileSaveStyle (FSS_FORCEFILE);
    8483                pset->SetForceSaveFile (argv[i]);
    85                 g_fSetPathName = TRUE;
    8684            }
    8785        }
     
    8987        else if (stricmp (argv[i], "-i") == 0)
    9088        {
    91             g_fIdle = TRUE;
    9289            pset->SetFlag (SEI_IDLEPRIORITY, TRUE);
    9390        }
     
    114111
    115112    //DisplayError("DEBUG", "%d", Version());
    116 #ifdef _QUIET_
    117     if ((Version() < 1))
     113#ifdef _USEDLL_
     114    if (g_fQuiet && (Version() < 1))
    118115    {
    119116        DisplayError("GOTCHA.DLL TO OLD",
     
    126123        exit (0);
    127124    }
    128 
    129     bool fPrtScr = FALSE;
    130     ULONG ulDataSize;
    131     int rc;
    132 
    133     rc = PrfQueryProfileSize( HINI_PROFILE, "PM_ControlPanel", "PrintScreen",
    134                              &ulDataSize );
    135     rc = PrfQueryProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
    136                              &fPrtScr, &ulDataSize);
    137     if (fPrtScr || !rc) {
    138         fPrtScr = TRUE;
    139         bool temp = FALSE;
    140         rc = PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
    141                                  &temp, sizeof(bool));
    142     }
    143125#endif
    144126
     
    152134    pset = new SETTINGS;
    153135
    154     pset->idleSetInIni = pset->QueryFlag(SEI_IDLEPRIORITY);
    155     pset->saveStyle = pset->QuerySaveStyle ();
    156     pset->pNumSaveDir = pset->QueryNumSaveDir ();
    157     pset->pForceSaveFile = pset->QueryForceSaveFile();
    158     pset->bSerialCapture = pset->SerialCapture ();
    159136    // check cmd line args and if "-a" found take screenshot and exit
    160137    if (CheckCmdlineArgs (argc, argv))
    161138    {
    162139        CaptureWindow (HWND_DESKTOP, HWND_DESKTOP, NULL, TRUE);
    163         pset->SetFileSaveStyle(pset->saveStyle);
    164140        delete pset;
    165141        WinDestroyMsgQueue (hmq);
     
    183159
    184160    // init the quiet mode
    185     //if (g_fQuiet)
    186     //{
    187 #ifdef _QUIET_
    188 //#if 1
    189     DebugHereIAm();
     161    if (g_fQuiet)
     162    {
     163#ifdef _USEDLL_
    190164        InitDLL (hab, hwndFrame);
    191165        StartInputHook ();
    192166#endif
    193167
    194         //CHAR ach[61];
    195         //WinQueryWindowText (hwndFrame, sizeof (ach), ach);
    196         //strcat (ach, RSTR (IDS_QUIETMODE));
    197         //WinSetWindowText (hwndFrame, ach);
    198         //WinSetWindowPos (hwndFrame, NULLHANDLE, 0,0, 0,0, SWP_MINIMIZE);
    199         //HSWITCH hswitch = WinQuerySwitchHandle(hwndFrame, 0);
    200         //WinRemoveSwitchEntry(hswitch);
    201     //}
     168        CHAR ach[61];
     169        WinQueryWindowText (hwndFrame, sizeof (ach), ach);
     170        strcat (ach, RSTR (IDS_QUIETMODE));
     171        WinSetWindowText (hwndFrame, ach);
     172        WinSetWindowPos (hwndFrame, NULLHANDLE, 0,0, 0,0, SWP_MINIMIZE);
     173    }
    202174
    203175    // position snapshot window
     
    224196        WinDispatchMsg (hab, &qmsg);
    225197
    226 
    227     // Set priorty to unless user set regular since running -q sets it to idle in the ini
    228     if (g_fIdle || g_fQuiet) {
    229         pset->SetFlag (SEI_IDLEPRIORITY, pset->idleSetInIni);
    230         if (g_fQuiet) {
    231             pset->SetFileSaveStyle (pset->saveStyle); // changed with -q
    232             pset->SerialCapture (pset->bSerialCapture); // changed with -q
    233         }
    234     }
    235     // Don't change the ini stored paths if the paths were set from the command line
    236     if (g_fSetPathName) {
    237         pset->SetFileSaveStyle(pset->saveStyle);
    238         pset->SetForceSaveFile (pset->pForceSaveFile);
    239         pset->SetNumSaveDir (pset->pNumSaveDir);
    240     }
    241198    // save size, etc. of snapshot window
    242199    WinQueryWindowPos (hwndSnapshot, &swp);
     
    251208    WinDestroyWindow (hwndFrame);
    252209
    253 #ifdef _QUIET_
    254 //#if 1
    255     if (fPrtScr || !rc) {
    256         PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
    257                             &fPrtScr, sizeof(bool));
    258     }
    259     //if (g_fQuiet)
     210#ifdef _USEDLL_
     211    if (g_fQuiet)
    260212        StopInputHook ();
    261213#endif
     
    290242}
    291243
    292 APIRET saymsg2(int DefaultButton, HWND hwnd,  PCSZ pszTitle, PCSZ pszFmt, ...)
    293 {
    294   ULONG i;
    295   APIRET rc;
    296   CHAR szMsg[4096];
    297   va_list va;
    298   MB2INFO *pmbInfo;
    299   MB2D mb2dBut[3];
    300   ULONG ulInfoSize = (sizeof(MB2INFO) + (sizeof(MB2D) * 2));
    301 
    302   va_start(va, pszFmt);
    303   szMsg[sizeof(szMsg) - 1] = 0;
    304   vsprintf(szMsg, pszFmt, va);
    305   va_end(va);
    306 
    307   if (szMsg[sizeof(szMsg) - 1]) {
    308     fprintf(stderr, "Buffer overflow in saymsg2 - need %u bytes\n", strlen(szMsg) + 1);
    309     fflush(stderr);
    310   }
    311 
    312   memset(mb2dBut, 0, sizeof(MB2D) * 3);
    313   strcpy(mb2dBut[0].achText,"Ok");
    314   strcpy(mb2dBut[1].achText,"Cancel");
    315   strcpy(mb2dBut[2].achText,"Settings");
    316   mb2dBut[0].idButton = 1;
    317   mb2dBut[1].idButton = 2;
    318   mb2dBut[2].idButton = 3;
    319   if (DefaultButton)
    320     mb2dBut[DefaultButton - 1].flStyle = BS_DEFAULT;
    321   pmbInfo = (MB2INFO *) malloc(ulInfoSize);
    322   memset(pmbInfo, 0, ulInfoSize);
    323   if (pmbInfo) {
    324     pmbInfo->cb         = ulInfoSize;
    325     pmbInfo->hIcon      = 0;
    326     pmbInfo->cButtons   = 3;
    327     pmbInfo->flStyle    = MB_MOVEABLE | MB_ICONQUESTION ;
    328     pmbInfo->hwndNotify = NULLHANDLE;
    329     for (i = 0; i < 3; i++) {
    330       memcpy( pmbInfo->mb2d+i , mb2dBut+i , sizeof(MB2D));
    331     }
    332     rc = WinMessageBox2(HWND_DESKTOP, hwnd,
    333                         szMsg, pszTitle, SM2_DIALOG,
    334                         pmbInfo);
    335     WinSetFocus(HWND_DESKTOP, SM2_DIALOG);
    336     free(pmbInfo);
    337     return rc;
    338   }
    339   return MBID_ERROR;
    340 }
    341 // ** AddSysMenuItem ****************************************************** /*FOLD00*/
     244// ** AddSysMenuItem ****************************************************** /*fold00*/
    342245
    343246VOID AddSysMenuItem (HWND hwndFrame, MENUITEM *Item, PSZ Text)
     
    370273VOID SetIdlePriority (BOOL f)
    371274{
    372 #if 0 //#ifndef _QUEIT_
    373275    if (f)
    374276        DosSetPriority(PRTYS_PROCESS, PRTYC_IDLETIME, 0, 0);
    375277    else
    376278        DosSetPriority(PRTYS_PROCESS, PRTYC_REGULAR, 0, 0);
    377 #else
    378     DosSetPriority(PRTYS_PROCESS, PRTYC_FOREGROUNDSERVER, 0, 0);
    379 #endif
    380279}
    381280
Note: See TracChangeset for help on using the changeset viewer.