You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Hooking.h 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. #ifndef WINVNCCONF_HOOKING
  19. #define WINVNCCONF_HOOKING
  20. #include <rfb_win32/Registry.h>
  21. #include <rfb_win32/Dialog.h>
  22. #include <rfb_win32/SDisplay.h>
  23. #include <rfb_win32/WMPoller.h>
  24. #include <rfb/ServerCore.h>
  25. namespace rfb {
  26. namespace win32 {
  27. class HookingPage : public PropSheetPage {
  28. public:
  29. HookingPage(const RegKey& rk)
  30. : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_HOOKING)), regKey(rk) {}
  31. void initDialog() {
  32. setItemChecked(IDC_USEPOLLING, rfb::win32::SDisplay::updateMethod == 0);
  33. setItemChecked(IDC_USEHOOKS, (rfb::win32::SDisplay::updateMethod == 1));
  34. setItemChecked(IDC_POLLCONSOLES, rfb::win32::WMPoller::poll_console_windows);
  35. setItemChecked(IDC_CAPTUREBLT, rfb::win32::DeviceFrameBuffer::useCaptureBlt);
  36. onCommand(IDC_USEHOOKS, 0);
  37. }
  38. bool onCommand(int id, int /*cmd*/) {
  39. switch (id) {
  40. case IDC_USEPOLLING:
  41. case IDC_USEHOOKS:
  42. case IDC_POLLCONSOLES:
  43. case IDC_CAPTUREBLT:
  44. setChanged(((rfb::win32::SDisplay::updateMethod == 0) != isItemChecked(IDC_USEPOLLING)) ||
  45. ((rfb::win32::SDisplay::updateMethod == 1) != isItemChecked(IDC_USEHOOKS)) ||
  46. (rfb::win32::WMPoller::poll_console_windows != isItemChecked(IDC_POLLCONSOLES)) ||
  47. (rfb::win32::DeviceFrameBuffer::useCaptureBlt != isItemChecked(IDC_CAPTUREBLT)));
  48. enableItem(IDC_POLLCONSOLES, isItemChecked(IDC_USEHOOKS));
  49. break;
  50. }
  51. return false;
  52. }
  53. bool onOk() {
  54. if (isItemChecked(IDC_USEPOLLING))
  55. regKey.setInt(_T("UpdateMethod"), 0);
  56. if (isItemChecked(IDC_USEHOOKS))
  57. regKey.setInt(_T("UpdateMethod"), 1);
  58. regKey.setBool(_T("PollConsoleWindows"), isItemChecked(IDC_POLLCONSOLES));
  59. regKey.setBool(_T("UseCaptureBlt"), isItemChecked(IDC_CAPTUREBLT));
  60. // *** LEGACY compatibility ***
  61. regKey.setBool(_T("UseHooks"), isItemChecked(IDC_USEHOOKS));
  62. return true;
  63. }
  64. protected:
  65. RegKey regKey;
  66. };
  67. };
  68. };
  69. #endif