This example loads a keyboard layout and gets the handle.
#include <stdio.h> #include <unikbd.h> int main(void) { KHAND kbdhandle; KBDNAME *kbd_name; 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; } return ULS_SUCCESS; }