keytune

Simple virtual like keyboard for Windows
git clone git://git.konyahin.xyz/keytune
Log | Files | Refs | README | LICENSE

keyboard.h (1435B)


      1 //  
      2 // Copyright (c) 2017 Konjahin A.A. <koniahin.ant@yandex.ru>
      3 // Licensed under the MIT License. See LICENSE file in the project root for full license information.  
      4 //
      5 
      6 #include <windows.h>
      7 #include <winuser.h>
      8 
      9 /**
     10  * Send press event for key with virtual-key codes
     11  * Arguments:
     12  *  ip - INPUT structure from winuser.h
     13  *  keyCode - WORD with virtual key-code from https://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx
     14  */
     15 void hold(INPUT *ip, WORD keyCode);
     16 
     17 /**
     18  * Send release event for key with virtual-key codes
     19  * Arguments:
     20  *  ip - INPUT structure from winuser.h
     21  *  keyCode - WORD with virtual key-code from https://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx
     22  */
     23 void release(INPUT *ip, WORD keyCode);
     24 
     25 /**
     26  * Send press and release event for key with virtual-key codes
     27  * Arguments:
     28  *  ip - INPUT structure from winuser.h
     29  *  keyCode - WORD with virtual key-code from https://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx
     30  */
     31 void press(INPUT *ip, WORD keyCode);
     32 
     33 /**
     34  * Put in buffer with wide chars text representation of keyboard's key
     35  * with virtual-key codes in current keyboard layout.
     36  * Arguments:
     37  *  keyCode - WORD with virtual key-code from https://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx
     38  *  buffer - wxhar_t* wide chars buffer for output
     39  *  bufferLength size_t size of buffer 
     40  */
     41 void getCharForKey(WORD keyCode, wchar_t* buffer, size_t bufferLength);