| 1 | /***
|
|---|
| 2 | Main source of the Gotcha! screencapture program.
|
|---|
| 3 | Copyright (C) 1998-2002 Thorsten Thielen <thth@c2226.de>
|
|---|
| 4 |
|
|---|
| 5 | This program is free software; you can redistribute it and/or modify
|
|---|
| 6 | it under the terms of the GNU General Public License as published by
|
|---|
| 7 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 8 | (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | This program is distributed in the hope that it will be useful,
|
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | GNU General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU General Public License
|
|---|
| 16 | along with this program; if not, write to the Free Software
|
|---|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 18 | ***/
|
|---|
| 19 |
|
|---|
| 20 | #define INCL_WINHOOKS
|
|---|
| 21 |
|
|---|
| 22 | #include "gotcha.h"
|
|---|
| 23 | #include "dll/gotchdll.h"
|
|---|
| 24 | #include "settings.h"
|
|---|
| 25 | #include "string.h"
|
|---|
| 26 |
|
|---|
| 27 | #include "io.h"
|
|---|
| 28 | #define INCL_EXCEPTQ_CLASS
|
|---|
| 29 | #define INCL_LOADEXCEPTQ
|
|---|
| 30 | #include "exceptq.h"
|
|---|
| 31 |
|
|---|
| 32 | HAB hab;
|
|---|
| 33 | HWND hwndFrame, hwndSnapshot;
|
|---|
| 34 | PFNWP OldFrameWP, wpOldButton;
|
|---|
| 35 | PSETTINGS pset;
|
|---|
| 36 | BOOL g_fQuiet = FALSE, g_fIdle = FALSE, g_fSetPathName = FALSE;
|
|---|
| 37 | HWND g_hwndMenuSSW;
|
|---|
| 38 | HMODULE g_hmod = NULLHANDLE;
|
|---|
| 39 | Helper *g_phelp = NULL;
|
|---|
| 40 |
|
|---|
| 41 | #include "bitmap.cpp"
|
|---|
| 42 | #include "mainwin.cpp"
|
|---|
| 43 | #include "snapshot.cpp"
|
|---|
| 44 | #include "savebmp.cpp"
|
|---|
| 45 |
|
|---|
| 46 | // ** CheckCmdlineArgs **************************************************** /*FOLD00*/
|
|---|
| 47 |
|
|---|
| 48 | BOOL CheckCmdlineArgs (int argc, char *argv[])
|
|---|
| 49 | {
|
|---|
| 50 | BOOL fAuto = FALSE;
|
|---|
| 51 |
|
|---|
| 52 | for (USHORT i = 1; i < argc; i++)
|
|---|
| 53 | {
|
|---|
| 54 | // quiet or batch mode
|
|---|
| 55 | if ((stricmp (argv[i], "-q") == 0) || (stricmp (argv[i], "-a") == 0))
|
|---|
| 56 | {
|
|---|
| 57 | if (pset->QuerySaveStyle () != FSS_FORCEFILE)
|
|---|
| 58 | pset->SetFileSaveStyle (FSS_NUMFILES);
|
|---|
| 59 |
|
|---|
| 60 | if (stricmp (argv[i], "-q") == 0)
|
|---|
| 61 | {
|
|---|
| 62 | pset->SerialCapture (FALSE);
|
|---|
| 63 | g_fQuiet = TRUE;
|
|---|
| 64 | }
|
|---|
| 65 | else
|
|---|
| 66 | fAuto = TRUE;
|
|---|
| 67 |
|
|---|
| 68 | if (i < argc-1)
|
|---|
| 69 | if (argv[i+1][0] != '-')
|
|---|
| 70 | {
|
|---|
| 71 | i++;
|
|---|
| 72 | pset->SetFileSaveStyle (FSS_NUMFILES);
|
|---|
| 73 | pset->SetNumSaveDir (argv[i]);
|
|---|
| 74 | g_fSetPathName = TRUE;
|
|---|
| 75 | }
|
|---|
| 76 | }
|
|---|
| 77 | // force saving to the given file name
|
|---|
| 78 | else if ((stricmp (argv[i], "-f") == 0) && (i < argc-1))
|
|---|
| 79 | {
|
|---|
| 80 | if (argv[i+1][0] != '-')
|
|---|
| 81 | {
|
|---|
| 82 | i++;
|
|---|
| 83 | pset->SetFileSaveStyle (FSS_FORCEFILE);
|
|---|
| 84 | pset->SetForceSaveFile (argv[i]);
|
|---|
| 85 | g_fSetPathName = TRUE;
|
|---|
| 86 | }
|
|---|
| 87 | }
|
|---|
| 88 | // set to idle priority
|
|---|
| 89 | else if (stricmp (argv[i], "-i") == 0)
|
|---|
| 90 | {
|
|---|
| 91 | g_fIdle = TRUE;
|
|---|
| 92 | pset->SetFlag (SEI_IDLEPRIORITY, TRUE);
|
|---|
| 93 | }
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | return fAuto;
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | // ** main **************************************************************** /*FOLD00*/
|
|---|
| 100 |
|
|---|
| 101 | int main (int argc, PSZ argv[])
|
|---|
| 102 | {
|
|---|
| 103 | ScopedExceptqLoader sel;
|
|---|
| 104 | #ifdef _DOLOGDEBUG_
|
|---|
| 105 | LogDebug( "Gotcha! start" );
|
|---|
| 106 | #endif
|
|---|
| 107 | #ifdef _DOLOGMEM_
|
|---|
| 108 | LogMem("main", TRUE);
|
|---|
| 109 | #endif
|
|---|
| 110 |
|
|---|
| 111 | // init system and msg queue
|
|---|
| 112 | hab = WinInitialize (0);
|
|---|
| 113 | HMQ hmq = WinCreateMsgQueue (hab, 0);
|
|---|
| 114 |
|
|---|
| 115 | //DisplayError("DEBUG", "%d", Version());
|
|---|
| 116 | //#ifdef _USEDLL_ //_QUIET_
|
|---|
| 117 | if ((Version() < 1))
|
|---|
| 118 | {
|
|---|
| 119 | DisplayError("GOTCHA.DLL TO OLD",
|
|---|
| 120 | "The file gotcha.dll is to old for this version of "
|
|---|
| 121 | "Gotcha! As you should have received a sufficiently "
|
|---|
| 122 | "new version with the program, check if an older "
|
|---|
| 123 | "version of gotcha.dll is still residing somewhere "
|
|---|
| 124 | "in your LIBPATH. And did you actually copy the new "
|
|---|
| 125 | "gotcha.dll to some directory in your LIBPATH?");
|
|---|
| 126 | exit (0);
|
|---|
| 127 | }
|
|---|
| 128 | bool fPrtScr = FALSE;
|
|---|
| 129 | ULONG ulDataSize;
|
|---|
| 130 | int rc;
|
|---|
| 131 |
|
|---|
| 132 | rc = PrfQueryProfileSize( HINI_PROFILE, "PM_ControlPanel", "PrintScreen",
|
|---|
| 133 | &ulDataSize );
|
|---|
| 134 | rc = PrfQueryProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
|
|---|
| 135 | &fPrtScr, &ulDataSize);
|
|---|
| 136 | if (fPrtScr || !rc) {
|
|---|
| 137 | fPrtScr = TRUE;
|
|---|
| 138 | bool temp = FALSE;
|
|---|
| 139 | rc = PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
|
|---|
| 140 | &temp, sizeof(bool));
|
|---|
| 141 | }
|
|---|
| 142 | //#endif
|
|---|
| 143 |
|
|---|
| 144 | // register our window classes
|
|---|
| 145 | WinRegisterClass (hab, "thth.wc.gotcha.main", WindowProcedure, 0L,
|
|---|
| 146 | sizeof (ULONG)*2L);
|
|---|
| 147 | WinRegisterClass (hab, "thth.wc.gotcha.snapshot", wpSnapshot,
|
|---|
| 148 | CS_SIZEREDRAW, sizeof (ULONG)*2L);
|
|---|
| 149 |
|
|---|
| 150 | // load the settings
|
|---|
| 151 | pset = new SETTINGS;
|
|---|
| 152 |
|
|---|
| 153 | pset->idleSetInIni = pset->QueryFlag(SEI_IDLEPRIORITY);
|
|---|
| 154 | pset->saveStyle = pset->QuerySaveStyle ();
|
|---|
| 155 | pset->pNumSaveDir = pset->QueryNumSaveDir ();
|
|---|
| 156 | pset->pForceSaveFile = pset->QueryForceSaveFile();
|
|---|
| 157 | pset->bSerialCapture = pset->SerialCapture ();
|
|---|
| 158 | // check cmd line args and if "-a" found take screenshot and exit
|
|---|
| 159 | if (CheckCmdlineArgs (argc, argv))
|
|---|
| 160 | {
|
|---|
| 161 | CaptureWindow (HWND_DESKTOP, HWND_DESKTOP, NULL, TRUE);
|
|---|
| 162 | pset->SetFileSaveStyle(pset->saveStyle);
|
|---|
| 163 | delete pset;
|
|---|
| 164 | WinDestroyMsgQueue (hmq);
|
|---|
| 165 | WinTerminate (hab);
|
|---|
| 166 | exit (0);
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 | SetIdlePriority(pset->QueryFlag(SEI_IDLEPRIORITY));
|
|---|
| 170 |
|
|---|
| 171 | // create the windows
|
|---|
| 172 | hwndFrame = CreateMainWindow ();
|
|---|
| 173 | hwndSnapshot = CreateSnapshotWindow ();
|
|---|
| 174 |
|
|---|
| 175 | SWP swp;
|
|---|
| 176 | USHORT us[7];
|
|---|
| 177 |
|
|---|
| 178 | // position main window
|
|---|
| 179 | pset->QueryWindowData (&swp, us, FALSE);
|
|---|
| 180 | WinSetWindowPos (hwndFrame, HWND_DESKTOP, swp.x,swp.y, 0,0,
|
|---|
| 181 | SWP_SHOW | SWP_MOVE);
|
|---|
| 182 |
|
|---|
| 183 | // init the quiet mode
|
|---|
| 184 | //if (g_fQuiet)
|
|---|
| 185 | //{
|
|---|
| 186 | #ifdef _USEDLL_ //_QUIET_
|
|---|
| 187 | InitDLL (hab, hwndFrame);
|
|---|
| 188 | StartInputHook ();
|
|---|
| 189 | #endif
|
|---|
| 190 |
|
|---|
| 191 | //CHAR ach[61];
|
|---|
| 192 | //WinQueryWindowText (hwndFrame, sizeof (ach), ach);
|
|---|
| 193 | //strcat (ach, RSTR (IDS_QUIETMODE));
|
|---|
| 194 | //WinSetWindowText (hwndFrame, ach);
|
|---|
| 195 | //WinSetWindowPos (hwndFrame, NULLHANDLE, 0,0, 0,0, SWP_MINIMIZE);
|
|---|
| 196 | //HSWITCH hswitch = WinQuerySwitchHandle(hwndFrame, 0);
|
|---|
| 197 | //WinRemoveSwitchEntry(hswitch);
|
|---|
| 198 | //}
|
|---|
| 199 |
|
|---|
| 200 | // position snapshot window
|
|---|
| 201 | pset->QueryWindowData (&swp, us);
|
|---|
| 202 |
|
|---|
| 203 | // size, activate & show window
|
|---|
| 204 | WinSetWindowPos (hwndSnapshot, HWND_DESKTOP, swp.x,swp.y, swp.cx,swp.cy,
|
|---|
| 205 | SWP_SHOW | SWP_SIZE | SWP_MOVE);
|
|---|
| 206 | if (! pset->SnapshotWindow ())
|
|---|
| 207 | WinShowWindow (hwndSnapshot, FALSE);
|
|---|
| 208 | else
|
|---|
| 209 | WinShowWindow (hwndSnapshot, TRUE);
|
|---|
| 210 |
|
|---|
| 211 | WinSetWindowPos (hwndFrame, NULLHANDLE, 0,0, 0,0, SWP_SHOW);
|
|---|
| 212 | WinSetWindowPos (WinWindowFromID (hwndFrame, FID_CLIENT), NULLHANDLE,
|
|---|
| 213 | 0,0, 0,0, SWP_SHOW);
|
|---|
| 214 |
|
|---|
| 215 | g_phelp = new Helper(hwndFrame);
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 | // do the main msg loop
|
|---|
| 219 | QMSG qmsg;
|
|---|
| 220 | while (WinGetMsg (hab, &qmsg, 0L, 0, 0))
|
|---|
| 221 | WinDispatchMsg (hab, &qmsg);
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 | // Set priorty to unless user set regular since running -q sets it to idle in the ini
|
|---|
| 225 | if (g_fIdle || g_fQuiet) {
|
|---|
| 226 | pset->SetFlag (SEI_IDLEPRIORITY, pset->idleSetInIni);
|
|---|
| 227 | if (g_fQuiet) {
|
|---|
| 228 | pset->SetFileSaveStyle (pset->saveStyle); // changed with -q
|
|---|
| 229 | pset->SerialCapture (pset->bSerialCapture); // changed with -q
|
|---|
| 230 | }
|
|---|
| 231 | }
|
|---|
| 232 | // Don't change the ini stored paths if the paths were set from the command line
|
|---|
| 233 | if (g_fSetPathName) {
|
|---|
| 234 | pset->SetFileSaveStyle(pset->saveStyle);
|
|---|
| 235 | pset->SetForceSaveFile (pset->pForceSaveFile);
|
|---|
| 236 | pset->SetNumSaveDir (pset->pNumSaveDir);
|
|---|
| 237 | }
|
|---|
| 238 | // save size, etc. of snapshot window
|
|---|
| 239 | WinQueryWindowPos (hwndSnapshot, &swp);
|
|---|
| 240 | pset->SetWindowData (&swp);
|
|---|
| 241 |
|
|---|
| 242 | // save size, etc. of main window
|
|---|
| 243 | WinQueryWindowPos (hwndFrame, &swp);
|
|---|
| 244 | pset->SetWindowData (&swp, FALSE);
|
|---|
| 245 |
|
|---|
| 246 | // goodbye windows!
|
|---|
| 247 | WinDestroyWindow (hwndSnapshot);
|
|---|
| 248 | WinDestroyWindow (hwndFrame);
|
|---|
| 249 |
|
|---|
| 250 | #ifdef _USEDLL_ //_QUIET_
|
|---|
| 251 | if (fPrtScr || !rc) {
|
|---|
| 252 | PrfWriteProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
|
|---|
| 253 | &fPrtScr, sizeof(bool));
|
|---|
| 254 | }
|
|---|
| 255 | //if (g_fQuiet)
|
|---|
| 256 | StopInputHook ();
|
|---|
| 257 | #endif
|
|---|
| 258 |
|
|---|
| 259 | delete g_phelp;
|
|---|
| 260 | delete pset;
|
|---|
| 261 |
|
|---|
| 262 | WinDestroyMsgQueue (hmq);
|
|---|
| 263 | WinTerminate (hab);
|
|---|
| 264 |
|
|---|
| 265 | #ifdef _DOLOGMEM_
|
|---|
| 266 | LogMem("main", FALSE);
|
|---|
| 267 | #endif
|
|---|
| 268 | #ifdef _DOLOGDEBUG_
|
|---|
| 269 | LogDebug( "Gotcha! end" );
|
|---|
| 270 | #endif
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 | // ** DisplayError ******************************************************** /*FOLD00*/
|
|---|
| 274 |
|
|---|
| 275 | VOID DisplayError (PSZ pszTitle, PSZ psz, ...)
|
|---|
| 276 | {
|
|---|
| 277 | CHAR dstring[401];
|
|---|
| 278 | va_list valst;
|
|---|
| 279 |
|
|---|
| 280 | va_start (valst, psz);
|
|---|
| 281 | vsnprintf (dstring, 401, psz, valst);
|
|---|
| 282 | va_end (valst);
|
|---|
| 283 |
|
|---|
| 284 | WinMessageBox (HWND_DESKTOP, WinQueryActiveWindow (HWND_DESKTOP), dstring,
|
|---|
| 285 | pszTitle, 0, MB_OK | MB_ERROR | MB_APPLMODAL | MB_MOVEABLE);
|
|---|
| 286 | }
|
|---|
| 287 |
|
|---|
| 288 | APIRET saymsg2(int DefaultButton, HWND hwnd, PCSZ pszTitle, PCSZ pszFmt, ...)
|
|---|
| 289 | {
|
|---|
| 290 | ULONG i;
|
|---|
| 291 | APIRET rc;
|
|---|
| 292 | CHAR szMsg[4096];
|
|---|
| 293 | va_list va;
|
|---|
| 294 | MB2INFO *pmbInfo;
|
|---|
| 295 | MB2D mb2dBut[3];
|
|---|
| 296 | ULONG ulInfoSize = (sizeof(MB2INFO) + (sizeof(MB2D) * 2));
|
|---|
| 297 |
|
|---|
| 298 | va_start(va, pszFmt);
|
|---|
| 299 | szMsg[sizeof(szMsg) - 1] = 0;
|
|---|
| 300 | vsprintf(szMsg, pszFmt, va);
|
|---|
| 301 | va_end(va);
|
|---|
| 302 |
|
|---|
| 303 | if (szMsg[sizeof(szMsg) - 1]) {
|
|---|
| 304 | fprintf(stderr, "Buffer overflow in saymsg2 - need %u bytes\n", strlen(szMsg) + 1);
|
|---|
| 305 | fflush(stderr);
|
|---|
| 306 | }
|
|---|
| 307 |
|
|---|
| 308 | memset(mb2dBut, 0, sizeof(MB2D) * 3);
|
|---|
| 309 | strcpy(mb2dBut[0].achText,"Ok");
|
|---|
| 310 | strcpy(mb2dBut[1].achText,"Cancel");
|
|---|
| 311 | strcpy(mb2dBut[2].achText,"Settings");
|
|---|
| 312 | mb2dBut[0].idButton = 1;
|
|---|
| 313 | mb2dBut[1].idButton = 2;
|
|---|
| 314 | mb2dBut[2].idButton = 3;
|
|---|
| 315 | if (DefaultButton)
|
|---|
| 316 | mb2dBut[DefaultButton - 1].flStyle = BS_DEFAULT;
|
|---|
| 317 | pmbInfo = (MB2INFO *) malloc(ulInfoSize);
|
|---|
| 318 | memset(pmbInfo, 0, ulInfoSize);
|
|---|
| 319 | if (pmbInfo) {
|
|---|
| 320 | pmbInfo->cb = ulInfoSize;
|
|---|
| 321 | pmbInfo->hIcon = 0;
|
|---|
| 322 | pmbInfo->cButtons = 3;
|
|---|
| 323 | pmbInfo->flStyle = MB_MOVEABLE | MB_ICONQUESTION ;
|
|---|
| 324 | pmbInfo->hwndNotify = NULLHANDLE;
|
|---|
| 325 | for (i = 0; i < 3; i++) {
|
|---|
| 326 | memcpy( pmbInfo->mb2d+i , mb2dBut+i , sizeof(MB2D));
|
|---|
| 327 | }
|
|---|
| 328 | rc = WinMessageBox2(HWND_DESKTOP, hwnd,
|
|---|
| 329 | szMsg, pszTitle, SM2_DIALOG,
|
|---|
| 330 | pmbInfo);
|
|---|
| 331 | WinSetFocus(HWND_DESKTOP, SM2_DIALOG);
|
|---|
| 332 | free(pmbInfo);
|
|---|
| 333 | return rc;
|
|---|
| 334 | }
|
|---|
| 335 | return MBID_ERROR;
|
|---|
| 336 | }
|
|---|
| 337 | // ** AddSysMenuItem ****************************************************** /*FOLD00*/
|
|---|
| 338 |
|
|---|
| 339 | VOID AddSysMenuItem (HWND hwndFrame, MENUITEM *Item, PSZ Text)
|
|---|
| 340 | {
|
|---|
| 341 | HWND hwndSysMenu = WinWindowFromID (hwndFrame, FID_SYSMENU);
|
|---|
| 342 | USHORT idSysMenu = SHORT1FROMMR (WinSendMsg (hwndSysMenu,
|
|---|
| 343 | MM_ITEMIDFROMPOSITION, NULL,
|
|---|
| 344 | NULL ));
|
|---|
| 345 | MENUITEM miSysMenu;
|
|---|
| 346 | WinSendMsg (hwndSysMenu, MM_QUERYITEM,
|
|---|
| 347 | MPFROM2SHORT (idSysMenu,FALSE), MPFROMP(&miSysMenu));
|
|---|
| 348 |
|
|---|
| 349 | HWND hwndSysSubMenu = miSysMenu.hwndSubMenu;
|
|---|
| 350 |
|
|---|
| 351 | WinSendMsg (hwndSysSubMenu, MM_INSERTITEM, MPFROMP(Item), MPFROMP(Text));
|
|---|
| 352 | }
|
|---|
| 353 |
|
|---|
| 354 | // ** DoCountdown ********************************************************* /*fold00*/
|
|---|
| 355 |
|
|---|
| 356 | VOID DoCountdown (ULONG ul)
|
|---|
| 357 | {
|
|---|
| 358 | if (ul > 10)
|
|---|
| 359 | DosBeep (4000L-3000L, 20);
|
|---|
| 360 | else
|
|---|
| 361 | DosBeep (4000L-ul*300L, 20);
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | // ** SetIdlePriority **************************************************** /*FOLD00*/
|
|---|
| 365 |
|
|---|
| 366 | VOID SetIdlePriority (BOOL f)
|
|---|
| 367 | {
|
|---|
| 368 | #if 0 //#ifndef _QUEIT_
|
|---|
| 369 | if (f)
|
|---|
| 370 | DosSetPriority(PRTYS_PROCESS, PRTYC_IDLETIME, 0, 0);
|
|---|
| 371 | else
|
|---|
| 372 | DosSetPriority(PRTYS_PROCESS, PRTYC_REGULAR, 0, 0);
|
|---|
| 373 | #else
|
|---|
| 374 | DosSetPriority(PRTYS_PROCESS, PRTYC_FOREGROUNDSERVER, 0, 0);
|
|---|
| 375 | #endif
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | // ***********************************************************************
|
|---|
| 379 |
|
|---|
| 380 | #ifdef _DOLOGMEM_
|
|---|
| 381 | VOID LogMem (PSZ psz, BOOL f)
|
|---|
| 382 | {
|
|---|
| 383 | FILE *pf = fopen("gotcha.mem","ab");
|
|---|
| 384 | static ULONG TotalPhysicalMemory, ul = 0;
|
|---|
| 385 | ULONG i;
|
|---|
| 386 | if (!f)
|
|---|
| 387 | ul--;
|
|---|
| 388 | DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &TotalPhysicalMemory,
|
|---|
| 389 | sizeof(TotalPhysicalMemory));
|
|---|
| 390 | for (i = 0; i < ul; i++)
|
|---|
| 391 | fputs(" ", pf);
|
|---|
| 392 | fprintf(pf,"%10ld (%s)\n", TotalPhysicalMemory, psz);
|
|---|
| 393 | if (f)
|
|---|
| 394 | ul++;
|
|---|
| 395 | fclose(pf);
|
|---|
| 396 | }
|
|---|
| 397 | #endif
|
|---|
| 398 |
|
|---|
| 399 | #ifdef _DOLOGDEBUG_
|
|---|
| 400 | VOID LogDebug( PSZ psz, ... )
|
|---|
| 401 | {
|
|---|
| 402 | CHAR dstring[401];
|
|---|
| 403 | va_list valst;
|
|---|
| 404 |
|
|---|
| 405 | va_start (valst, psz);
|
|---|
| 406 | vsnprintf (dstring, 401, psz, valst);
|
|---|
| 407 | va_end (valst);
|
|---|
| 408 |
|
|---|
| 409 | FILE *pf = fopen( "gotcha.log", "ab" );
|
|---|
| 410 | fprintf( pf, "%s\n", dstring );
|
|---|
| 411 | fclose( pf );
|
|---|
| 412 | }
|
|---|
| 413 | #endif
|
|---|
| 414 |
|
|---|
| 415 | // ***********************************************************************
|
|---|