Changes in trunk/gotcha.cpp [30:13]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gotcha.cpp
r30 r13 34 34 PFNWP OldFrameWP, wpOldButton; 35 35 PSETTINGS pset; 36 BOOL g_fQuiet = FALSE , g_fIdle = FALSE, g_fSetPathName = FALSE;36 BOOL g_fQuiet = FALSE; 37 37 HWND g_hwndMenuSSW; 38 38 HMODULE g_hmod = NULLHANDLE; … … 44 44 #include "savebmp.cpp" 45 45 46 // ** CheckCmdlineArgs **************************************************** /* FOLD00*/46 // ** CheckCmdlineArgs **************************************************** /*fold00*/ 47 47 48 48 BOOL CheckCmdlineArgs (int argc, char *argv[]) … … 72 72 pset->SetFileSaveStyle (FSS_NUMFILES); 73 73 pset->SetNumSaveDir (argv[i]); 74 g_fSetPathName = TRUE;75 74 } 76 75 } … … 83 82 pset->SetFileSaveStyle (FSS_FORCEFILE); 84 83 pset->SetForceSaveFile (argv[i]); 85 g_fSetPathName = TRUE;86 84 } 87 85 } … … 89 87 else if (stricmp (argv[i], "-i") == 0) 90 88 { 91 g_fIdle = TRUE;92 89 pset->SetFlag (SEI_IDLEPRIORITY, TRUE); 93 90 } … … 114 111 115 112 //DisplayError("DEBUG", "%d", Version()); 116 #ifdef _ QUIET_117 if ( (Version() < 1))113 #ifdef _USEDLL_ 114 if (g_fQuiet && (Version() < 1)) 118 115 { 119 116 DisplayError("GOTCHA.DLL TO OLD", … … 126 123 exit (0); 127 124 } 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 }143 125 #endif 144 126 … … 152 134 pset = new SETTINGS; 153 135 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 ();159 136 // check cmd line args and if "-a" found take screenshot and exit 160 137 if (CheckCmdlineArgs (argc, argv)) 161 138 { 162 139 CaptureWindow (HWND_DESKTOP, HWND_DESKTOP, NULL, TRUE); 163 pset->SetFileSaveStyle(pset->saveStyle);164 140 delete pset; 165 141 WinDestroyMsgQueue (hmq); … … 183 159 184 160 // 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_ 190 164 InitDLL (hab, hwndFrame); 191 165 StartInputHook (); 192 166 #endif 193 167 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 } 202 174 203 175 // position snapshot window … … 224 196 WinDispatchMsg (hab, &qmsg); 225 197 226 227 // Set priorty to unless user set regular since running -q sets it to idle in the ini228 if (g_fIdle || g_fQuiet) {229 pset->SetFlag (SEI_IDLEPRIORITY, pset->idleSetInIni);230 if (g_fQuiet) {231 pset->SetFileSaveStyle (pset->saveStyle); // changed with -q232 pset->SerialCapture (pset->bSerialCapture); // changed with -q233 }234 }235 // Don't change the ini stored paths if the paths were set from the command line236 if (g_fSetPathName) {237 pset->SetFileSaveStyle(pset->saveStyle);238 pset->SetForceSaveFile (pset->pForceSaveFile);239 pset->SetNumSaveDir (pset->pNumSaveDir);240 }241 198 // save size, etc. of snapshot window 242 199 WinQueryWindowPos (hwndSnapshot, &swp); … … 251 208 WinDestroyWindow (hwndFrame); 252 209 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) 260 212 StopInputHook (); 261 213 #endif … … 290 242 } 291 243 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*/ 342 245 343 246 VOID AddSysMenuItem (HWND hwndFrame, MENUITEM *Item, PSZ Text) … … 370 273 VOID SetIdlePriority (BOOL f) 371 274 { 372 #if 0 //#ifndef _QUEIT_373 275 if (f) 374 276 DosSetPriority(PRTYS_PROCESS, PRTYC_IDLETIME, 0, 0); 375 277 else 376 278 DosSetPriority(PRTYS_PROCESS, PRTYC_REGULAR, 0, 0); 377 #else378 DosSetPriority(PRTYS_PROCESS, PRTYC_FOREGROUNDSERVER, 0, 0);379 #endif380 279 } 381 280
Note:
See TracChangeset
for help on using the changeset viewer.