This example queries information from a loaded keyboard table.
#include <stdio.h> #include <unikbd.h> int main(void) { KHAND kbdhandle; KBDNAME *kbd_name; KEYBOARDINFO kbdinfo; ULONG mode = 0; APIRET rc; /***************************************************/ /* Create a keyboard handle for US keyboard layout */ /***************************************************/ kbd_name = (UniChar*)L"us"; rc = UniCreateKeyboard( &kbdhandle, kbd_name, mode ); if ( rc != ULS_SUCCESS ) { printf("UniCreateKeyboard error: return code = %u\n", rc ); return 1; } /* Query Keyboard Information Packet*/ rc = UniQueryKeyboard( kbdhandle, &kbdinfo ); if ( rc != ULS_SUCCESS ) { printf("UniQueryKeyboard error: return code = %u\n", rc ); return 1; } return ULS_SUCCESS; }