SmartCode ViewerX

ISmartCodeVNCViewer2::SendCustomKeyEx Function


Sends key up or key down notifications to a remote VNC server.

Syntax

HRESULT ISmartCodeVNCViewer2::SendCustomKeyEx(long lKeyCode, VARIANT_BOOL bKeyDownEvent);

Parameters

lKeyCode
Specifies the scan code of the key, which will be sent to server.
bKeyDownEvent
VARIANT_TRUE - key down event, VARIANT_FALSE - key up event.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The table below lists the scan codes supported by Windows VNC servers.
NOTE: This list may be incomplete. Please refer to the following document for more information about Windows keyboard scan codes:
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc

XK_VoidSymbol 0xFFFFFF
XK_space 0x020
XK_BackSpace 0xFF08
XK_Tab 0xFF09
XK_Linefeed 0xFF0A
XK_Clear 0xFF0B
XK_Return 0xFF0D
XK_Pause 0xFF13
XK_Scroll_Lock 0xFF14
XK_Sys_Req 0xFF15
XK_Escape 0xFF1B
XK_Delete 0xFFFF
XK_Print 0xFF61
XK_dead_grave 0xFE50
XK_dead_acute 0xFE51
XK_dead_circumflex 0xFE52
XK_dead_tilde 0xFE53
XK_dead_diaeresis 0xFE57
XK_Home 0xFF50
XK_Left 0xFF51
XK_Up 0xFF52
XK_Right 0xFF53
XK_Down 0xFF54
XK_Page_Up 0xFF55
XK_Page_Down 0xFF56
XK_End 0xFF57
XK_Begin 0xFF58
XK_Select 0xFF60
XK_Print 0xFF61
XK_Execute 0xFF62
XK_Insert 0xFF63
XK_Cancel 0xFF69
XK_Help 0xFF6A
XK_Break 0xFF6B
XK_Num_Lock 0xFF7F
XK_KP_Space 0xFF80
XK_KP_Tab 0xFF89
XK_KP_Enter 0xFF8D
XK_KP_Home 0xFF95
XK_KP_Left 0xFF96
XK_KP_Up 0xFF97
XK_KP_Right 0xFF98
XK_KP_Down 0xFF99
XK_KP_Prior 0xFF9A
XK_KP_Page_Up 0xFF9A
XK_KP_Next 0xFF9B
XK_KP_Page_Down 0xFF9B
XK_KP_End 0xFF9C
XK_KP_Begin 0xFF9D
XK_KP_Insert 0xFF9E
XK_KP_Delete 0xFF9F
XK_KP_Equal 0xFFBD
XK_KP_Multiply 0xFFAA
XK_KP_Add 0xFFAB
XK_KP_Separator 0xFFAC
XK_KP_Subtract 0xFFAD
XK_KP_Decimal 0xFFAE
XK_KP_Divide 0xFFAF
XK_KP_0 0xFFB0
XK_KP_1 0xFFB1
XK_KP_2 0xFFB2
XK_KP_3 0xFFB3
XK_KP_4 0xFFB4
XK_KP_5 0xFFB5
XK_KP_6 0xFFB6
XK_KP_7 0xFFB7
XK_KP_8 0xFFB8
XK_KP_9 0xFFB9
XK_F1 0xFFBE
XK_F2 0xFFBF
XK_F3 0xFFC0
XK_F4 0xFFC1
XK_F5 0xFFC2
XK_F6 0xFFC3
XK_F7 0xFFC4
XK_F8 0xFFC5
XK_F9 0xFFC6
XK_F10 0xFFC7
XK_F11 0xFFC8
XK_F12 0xFFC9
XK_F13 0xFFCA
XK_F14 0xFFCB
XK_F15 0xFFCC
XK_F16 0xFFCD
XK_F17 0xFFCE
XK_F18 0xFFCF
XK_F19 0xFFD0
XK_F20 0xFFD1
XK_F21 0xFFD2
XK_F22 0xFFD3
XK_F23 0xFFD4
XK_F24 0xFFD5
XK_Shift_L 0xFFE1
XK_Shift_R 0xFFE2
XK_Control_L 0xFFE3
XK_Control_R 0xFFE4
XK_Caps_Lock 0xFFE5
XK_Shift_Lock 0xFFE6
XK_Meta_L 0xFFE7
XK_Meta_R 0xFFE8
XK_Alt_L 0xFFE9
XK_Alt_R 0xFFEA

Example

The example below shows how to send Ctrl+Alt+Del combination to a remote VNC server:
viewerX.SendCustomKeyEx(65507, true);
viewerX.SendCustomKeyEx(65513, true);
viewerX.SendCustomKeyEx(65535, true);
viewerX.SendCustomKeyEx(65535, false);
viewerX.SendCustomKeyEx(65513, false);
viewerX.SendCustomKeyEx(65507, false);