Hi,

I always wanted to quit vncviewer via a simple hotkey and not via the 
start menu. Here is the patch for it (The hotkey is <Win>+Q):

diff -ru vncviewer.org/ClientConnection.cpp 
vncviewer/ClientConnection.cpp
--- vncviewer.org/ClientConnection.cpp Mon May 15 17:04:56 2000
+++ vncviewer/ClientConnection.cpp Sat Jun 22 22:17:08 2002
@@ -226,6 +226,7 @@
          NULL);
 
  ShowWindow(m_hwnd, SW_HIDE);
+ RegisterHotKey(m_hwnd, HK_CLOSE, MOD_WIN, 'Q');
 
  // record which client created this window
  SetWindowLong(m_hwnd, GWL_USERDATA, (LONG) this);
@@ -284,6 +285,8 @@
   AppendMenu(hsysmenu, MF_SEPARATOR, NULL, NULL);
   AppendMenu(hsysmenu, MF_STRING, ID_CLOSEDAEMON, _T("Close 
listening &daemon"));
  }
+    AppendMenu(hsysmenu, MF_SEPARATOR, NULL, NULL);
+ AppendMenu(hsysmenu, MF_STRING, SC_CLOSE, "&Quit");
  DrawMenuBar(m_hwnd);
 
  // Set up clipboard watching
@@ -776,6 +779,7 @@
 
 ClientConnection::~ClientConnection()
 {
+ UnregisterHotKey(m_hwnd, HK_CLOSE);
  if (m_hwnd != 0)
   DestroyWindow(m_hwnd);
 
@@ -1110,6 +1114,11 @@
 
   }
         break;
+
+ case WM_HOTKEY:
+  if (wParam == HK_CLOSE)
+   PostMessage(hwnd, WM_CLOSE, 0, 0);
+  break;
 
 #ifndef UNDER_CE
  case WM_SIZING:
diff -ru vncviewer.org/ClientConnection.h vncviewer/ClientConnection.h
--- vncviewer.org/ClientConnection.h Mon May 15 17:04:58 2000
+++ vncviewer/ClientConnection.h Sat Jun 22 22:07:32 2002
@@ -36,6 +36,7 @@
 
 #define SETTINGS_KEY_NAME "Software\\ORL\\VNCviewer\\Settings"
 #define MAX_HOST_NAME_LEN 250
+const int HK_CLOSE = 32;
 
 class ClientConnection  : public omni_thread
 {


If the lines are broken, you can find it on 
http://codesnippet.d2g.com/?cmd=edit_form&num=83

Roland
_______________________________________________
VNC-List mailing list
[EMAIL PROTECTED]
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to