home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Asuka / source / snapsetup.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.0 KB  |  60 lines

  1. //    Asuka - VirtualDub Build/Post-Mortem Utility
  2. //    Copyright (C) 2005 Avery Lee
  3. //
  4. //    This program is free software; you can redistribute it and/or modify
  5. //    it under the terms of the GNU General Public License as published by
  6. //    the Free Software Foundation; either version 2 of the License, or
  7. //    (at your option) any later version.
  8. //
  9. //    This program is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. //    GNU General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU General Public License
  15. //    along with this program; if not, write to the Free Software
  16. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #include "stdafx.h"
  19. #include <vd2/system/vdtypes.h>
  20. #include <stdio.h>
  21. #include <windows.h>
  22.  
  23. namespace {
  24.     BOOL WINAPI CtrlCFunc(DWORD event) {
  25.         return event == CTRL_C_EVENT || event == CTRL_BREAK_EVENT;
  26.     }
  27. }
  28.  
  29. void tool_snapsetup() {
  30.     SetConsoleCtrlHandler(CtrlCFunc, TRUE);
  31.  
  32.     BOOL fontSmoothing;
  33.  
  34.     // disable font smoothing
  35.     SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fontSmoothing, 0);
  36.     SystemParametersInfo(SPI_SETFONTSMOOTHING, FALSE, NULL, 0);
  37.  
  38.     // disable title bar gradient
  39.     const INT kColorsToSet[]={ COLOR_GRADIENTACTIVECAPTION, COLOR_GRADIENTINACTIVECAPTION };
  40.     const COLORREF oldColorValues[]={ GetSysColor(COLOR_GRADIENTACTIVECAPTION), GetSysColor(COLOR_GRADIENTINACTIVECAPTION) };
  41.     const COLORREF newColorValues[]={ GetSysColor(COLOR_ACTIVECAPTION), GetSysColor(COLOR_INACTIVECAPTION) };
  42.  
  43.     SetSysColors(2, kColorsToSet, newColorValues);
  44.  
  45.     // refresh screen
  46.     InvalidateRect(NULL, NULL, TRUE);
  47.  
  48.     puts("Display set up for screenshots. Press Return to restore system settings.");
  49.     getchar();
  50.  
  51.     // restore title bar gradient
  52.     SetSysColors(2, kColorsToSet, oldColorValues);
  53.  
  54.     // restore font smoothing
  55.     SystemParametersInfo(SPI_SETFONTSMOOTHING, fontSmoothing, NULL, 0);
  56.  
  57.     // refresh screen
  58.     InvalidateRect(NULL, NULL, TRUE);
  59. }
  60.