Index: src/client/c/hu/varadiistvan/xplra/xplra.cc
===================================================================
--- src/client/c/hu/varadiistvan/xplra/xplra.cc	(revision 40)
+++ src/client/c/hu/varadiistvan/xplra/xplra.cc	(revision 55)
@@ -1309,4 +1309,55 @@
 //------------------------------------------------------------------------------
 
+extern "C" int xplra_register_hotkeys(int connectionID,
+                                      const uint16_t* codes, size_t length)
+{
+    Connection* connection = ConnectionSlot::getValue(connectionID);
+    if (connection==0) return -1;
+
+    try {
+        connection->registerHotkeys(codes, length);
+        return 0;
+    } catch(...) {
+        connection->handleException();
+        return -1;
+    }
+}
+
+/*----------------------------------------------------------------------------*/
+
+extern "C" int xplra_query_hotkeys(int connectionID,
+                                   uint8_t* states, size_t length)
+{
+    Connection* connection = ConnectionSlot::getValue(connectionID);
+    if (connection==0) return -1;
+
+    try {
+        connection->queryHotkeys(states, length);
+        return 0;
+    } catch(...) {
+        connection->handleException();
+        return -1;
+    }
+}
+
+/*----------------------------------------------------------------------------*/
+
+extern "C" int xplra_unregister_hotkeys(int connectionID)
+{
+    Connection* connection = ConnectionSlot::getValue(connectionID);
+    if (connection==0) return -1;
+
+    try {
+        connection->unregisterHotkeys();
+        return 0;
+    } catch(...) {
+        connection->handleException();
+        return -1;
+    }
+}
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
 extern "C" int xplra_disconnect(int connectionID)
 {
Index: src/client/c/hu/varadiistvan/xplra/xplra.h
===================================================================
--- src/client/c/hu/varadiistvan/xplra/xplra.h	(revision 40)
+++ src/client/c/hu/varadiistvan/xplra/xplra.h	(revision 55)
@@ -99,4 +99,12 @@
 /*----------------------------------------------------------------------------*/
 
+/** Hotkey modifier: Shift */
+#define HOTKEY_MODIFIER_SHIFT 0x01
+
+/** Hotkey modifier: Control */
+#define HOTKEY_MODIFIER_CONTROL 0x02
+
+/*----------------------------------------------------------------------------*/
+
 #define INVALID_DATAREF_ID ((size_t)-1)
 
@@ -751,4 +759,28 @@
 
 /**
+ * Register the given hotkey codes for listening. If there is an
+ * existing set of hotkeys registered, those will be overwritten.
+ */
+int xplra_register_hotkeys(int connectionID,
+                           const uint16_t* codes, size_t length);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * Query the registered hotkeys whether they were pressed.
+ */
+int xplra_query_hotkeys(int connectionID, uint8_t* states, size_t length);
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * Unregister the hotkeys.
+ */
+int xplra_unregister_hotkeys(int connectionID);
+
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+
+/**
  * Destroy the connection with the given ID.
  *
Index: test/Makefile.am
===================================================================
--- test/Makefile.am	(revision 54)
+++ test/Makefile.am	(revision 55)
@@ -6,5 +6,5 @@
 endif
 
-noinst_PROGRAMS=ctest basictest basicctest multigettest multigetctest multisettest multisetctest hotkeytest
+noinst_PROGRAMS=ctest basictest basicctest multigettest multigetctest multisettest multisetctest hotkeytest hotkeyctest
 
 ctest_SOURCES=ctest.c
@@ -36,4 +36,9 @@
 hotkeytest_SOURCES=hotkeytest.cc
 
+hotkeyctest_SOURCES=hotkeyctest.c
+if TARGET_API_WIN32
+hotkeyctest_LDFLAGS=-lstdc++
+endif
+
 EXTRA_DIST=\
         runpy.sh                \
Index: test/basicctest.c
===================================================================
--- test/basicctest.c	(revision 40)
+++ test/basicctest.c	(revision 55)
@@ -43,10 +43,10 @@
 
 #ifdef _WIN32
-void _sleep(int ms)
+void xplra_sleep(int ms)
 {
     Sleep(ms);
 }
 #else
-void _sleep(int ms)
+void xplra_sleep(int ms)
 {
     usleep(ms*1000);
@@ -367,5 +367,5 @@
 
     printf("Preparing for the message tests, sleeping for 5 seconds...\n");
-    _sleep(5*1000);
+    xplra_sleep(5*1000);
 
     printf("Showing a message for 10 seconds...\n");
@@ -375,5 +375,5 @@
 
     printf("Sleeping for 3 seconds...\n");
-    _sleep(3*1000);
+    xplra_sleep(3*1000);
 
     printf("Showing another message interrupting the previous one for 3 seconds");
@@ -383,5 +383,5 @@
 
     printf("Sleeping for 5 seconds...\n");
-    _sleep(5*1000);
+    xplra_sleep(5*1000);
     if (xplra_show_message(connectionID, "[basictest] and the tests come to an end!", 5.0)<0) {
         goto error;
@@ -389,4 +389,5 @@
 
     goto cleanup;
+
 error:
     errorString = xplra_get_last_error_string(connectionID);
Index: test/hotkeyctest.c
===================================================================
--- test/hotkeyctest.c	(revision 55)
+++ test/hotkeyctest.c	(revision 55)
@@ -0,0 +1,147 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include <hu/varadiistvan/xplra/xplra.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef _WIN32
+void xplra_sleep(int ms)
+{
+    Sleep(ms);
+}
+#else
+void xplra_sleep(int ms)
+{
+    usleep(ms*1000);
+}
+#endif
+
+
+//------------------------------------------------------------------------------
+
+int main()
+{
+    int retval = 0;
+    const char* errorString = 0;
+
+    uint16_t codes[] = { 0x0241, 0x0142, 0x0343, 0x0251 };
+
+    printf("Connecting to X-Plane...\n");
+    int connectionID = xplra_connect();
+
+    if (connectionID>=0) {
+        printf("Connected.\n\n");
+    } else {
+        printf("Connection failed.\n");
+        goto cleanup;
+    }
+
+
+    printf("Registering hotkeys: Ctrl+A, Shift+B, Ctrl+Shift+C, Ctrl+Q...\n");
+    if (xplra_register_hotkeys(connectionID,
+                               codes, sizeof(codes)/sizeof(uint16_t))<0)
+    {
+        goto error;
+    }
+    printf("Registered hotkeys...\n\n");
+
+    printf("Listening to hotkeys...\n");
+    while(1) {
+        uint8_t states[4];
+        char message[256];
+
+        if (xplra_query_hotkeys(connectionID, states, sizeof(states))<0) {
+            goto error;
+        }
+
+        if (states[3]!=0) {
+            if (xplra_unregister_hotkeys(connectionID)<0) {
+                goto error;
+            }
+            break;
+        }
+
+        message[0] = '\0';
+
+        if (states[0]!=0) {
+            if (message[0]!='\0') strcat(message, ", ");
+            strcat(message, "Ctrl+A");
+        }
+        if (states[1]!=0) {
+            if (message[0]!='\0') strcat(message, ", ");
+            strcat(message, "Shift+B");
+        }
+        if (states[2]!=0) {
+            if (message[0]!='\0') strcat(message, ", ");
+            strcat(message, "Ctrl+Shift+C");
+        }
+
+        if (message[0]!='\0') {
+            strcat(message, " pressed");
+            if (xplra_show_message(connectionID, message, 3.0)<0) {
+                goto error;
+            }
+        }
+
+        xplra_sleep(500);
+    }
+
+    goto cleanup;
+
+error:
+    errorString = xplra_get_last_error_string(connectionID);
+    if (errorString==0) {
+        printf("\nUnknown error occured!\n");
+    } else {
+        printf("\nError: %s\n", errorString);
+    }
+
+cleanup:
+    if (connectionID>=0) xplra_disconnect(connectionID);
+    return retval;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
