Changeset 57 for trunk/gotcha.cpp


Ignore:
Timestamp:
Nov 4, 2018, 10:38:51 PM (7 years ago)
Author:
Gregg Young
Message:

Add a -p command line switch to allow use of the default PM Print screen behavior (capture to printer)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gotcha.cpp

    r55 r57  
    3838HMODULE     g_hmod = NULLHANDLE;
    3939Helper      *g_phelp = NULL;
     40BOOL        g_usePMps = FALSE;
    4041
    4142#include "bitmap.cpp"
     
    8485            pset->SetFlag (SEI_IDLEPRIORITY, TRUE);
    8586        }
     87#ifdef _QUIET_
     88        // use default PM print screen
     89        else if (stricmp (argv[i], "-p") == 0)
     90        {
     91            g_usePMps = TRUE;
     92        }
     93#endif
    8694    }
    8795
     
    150158    pset->bSerialCapture = pset->SerialCapture ();
    151159
    152 #ifdef _QUIET_
    153     bool fPrtScr = FALSE;
    154     // always turn it off while running
    155     // WinSet does not effect the ini setting
    156     WinSetSysValue(HWND_DESKTOP, SV_PRINTSCREEN , fPrtScr);
    157 #endif
    158160    // check cmd line args and if "-a" found take screenshot and exit
    159161    if (CheckCmdlineArgs (argc, argv))
     
    184186   
    185187#ifdef _QUIET_
    186         InitDLL (hab, hwndFrame);
    187         StartInputHook ();
     188    bool fPrtScr = FALSE;
     189    if (!g_usePMps) {
     190        // always turn it off while running
     191        // WinSet does not effect the ini setting
     192        WinSetSysValue(HWND_DESKTOP, SV_PRINTSCREEN , fPrtScr);
     193    }
     194    InitDLL (hab, hwndFrame, g_usePMps);
     195    StartInputHook ();
    188196#endif
    189197
     
    236244#ifdef _QUIET_
    237245    // Reset to user PM print screen choice
    238     ULONG ulDataSize = 0;
    239     rc = PrfQueryProfileSize(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
    240                              &ulDataSize );
    241     rc = PrfQueryProfileData(HINI_USERPROFILE, "PM_ControlPanel", "PrintScreen",
    242                              &fPrtScr, &ulDataSize);
    243     if (!rc) // Print screen is on by default (no ini entry)
    244         fPrtScr = TRUE;
    245     WinSetSysValue(HWND_DESKTOP, SV_PRINTSCREEN , fPrtScr);
     246    if (!g_usePMps) {
     247        ULONG ulDataSize = 0;
     248        rc = PrfQueryProfileSize(HINI_USERPROFILE, "PM_ControlPanel",
     249                                 "PrintScreen", &ulDataSize );
     250        rc = PrfQueryProfileData(HINI_USERPROFILE, "PM_ControlPanel",
     251                                 "PrintScreen", &fPrtScr, &ulDataSize);
     252        if (!rc) // Print screen is on by default (no ini entry)
     253            fPrtScr = TRUE;
     254        WinSetSysValue(HWND_DESKTOP, SV_PRINTSCREEN , fPrtScr);
     255    }
    246256    StopInputHook ();
    247257    DosCloseMutexSem(hmtx);
Note: See TracChangeset for help on using the changeset viewer.