Changeset 50 for trunk/gotcha.cpp
- Timestamp:
- Apr 7, 2018, 9:52:46 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gotcha.cpp
r38 r50 107 107 //DisplayError("DEBUG", "%d", Version()); 108 108 #ifdef _QUIET_ 109 if ((Version() < 1))109 if ((Version() < 2)) 110 110 { 111 111 DisplayError("GOTCHDLL.DLL TOO OLD", … … 118 118 exit (0); 119 119 } 120 121 bool fPrtScr = FALSE;122 ULONG ulDataSize;123 120 int rc; 124 125 rc = PrfQueryProfileSize( HINI_PROFILE, "PM_ControlPanel", "PrintScreen", 126 &ulDataSize ); 127 rc = PrfQueryProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen", 128 &fPrtScr, &ulDataSize); 129 if (fPrtScr || !rc) { 130 fPrtScr = TRUE; 131 bool temp = FALSE; 132 rc = PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen", 133 &temp, sizeof(bool)); 121 HMTX hmtx = NULLHANDLE; 122 // running multiple instances orphans all but the first closed hook unloaded 123 rc = DosOpenMutexSem("\\SEM32\\GOTCHA", &hmtx); 124 if (!rc) { 125 DisplayError("GOTCHA QUIET ALREADY RUNNING", 126 "Another instance of Gotcha Quiet is running." 127 " You can open Gotcha Quiet's settings using" 128 " the Alt+Print Screen key combination"); 129 exit (0); 130 } 131 rc = DosCreateMutexSem("\\SEM32\\GOTCHA", &hmtx, 0, FALSE); 132 if (rc) { 133 DisplayError("Semaphore creation failed", 134 "Try restarting Gotcha Quiet"); 135 exit (0); 134 136 } 135 137 #endif … … 149 151 pset->pForceSaveFile = pset->QueryForceSaveFile(); 150 152 pset->bSerialCapture = pset->SerialCapture (); 153 154 #ifdef _QUIET_ 155 bool fPrtScr = FALSE; 156 ULONG ulDataSize = 0; 157 158 rc = PrfQueryProfileSize( HINI_PROFILE, "PM_ControlPanel", "PrintScreen", 159 &ulDataSize ); 160 rc = PrfQueryProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen", 161 &fPrtScr, &ulDataSize); 162 bool temp = FALSE;// always turn it off while running 163 PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", 164 "PrintScreen", &temp, sizeof(bool)); 165 PrfQueryProfileSize(pset->QueryPrfHandle (), "PM", 166 "PrintScreen", &ulDataSize ); 167 int rc1 = PrfQueryProfileData(pset->QueryPrfHandle (), "PM", 168 "PrintScreen", &temp, &ulDataSize); 169 bool temp2 = TRUE; 170 PrfQueryProfileData(pset->QueryPrfHandle (), "PM", 171 "PrintScreen", &temp2, &ulDataSize); 172 if (!rc1 || (temp2 && (temp != fPrtScr))) { // no entry or user has changed PM setting 173 if (!rc) // Print screen is on by default (no ini entry) 174 fPrtScr = TRUE; 175 PrfWriteProfileData(pset->QueryPrfHandle (), "PM", 176 "PrintScreen", &fPrtScr, sizeof(bool)); 177 } 178 temp = FALSE; 179 PrfWriteProfileData(pset->QueryPrfHandle (), "PM", 180 "Exited", &temp, sizeof(bool)); 181 #endif 151 182 // check cmd line args and if "-a" found take screenshot and exit 152 183 if (CheckCmdlineArgs (argc, argv)) … … 228 259 229 260 #ifdef _QUIET_ 230 if (fPrtScr || !rc) { 231 PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen", 232 &fPrtScr, sizeof(bool)); 233 } 261 PrfQueryProfileSize(pset->QueryPrfHandle (), "PM", 262 "PrintScreen", &ulDataSize ); 263 PrfQueryProfileData(pset->QueryPrfHandle (), "PM", 264 "PrintScreen", &fPrtScr, &ulDataSize); 265 PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen", 266 &fPrtScr, sizeof(bool)); 267 temp = TRUE; 268 PrfWriteProfileData(pset->QueryPrfHandle (), "PM", 269 "Exited", &temp, sizeof(bool)); 270 234 271 StopInputHook (); 235 #endif 236 272 DosCloseMutexSem(hmtx); 273 #endif 274 237 275 delete g_phelp; 238 276 delete pset;
Note:
See TracChangeset
for help on using the changeset viewer.