This example translates a dead key and a Unicode character to a composite character.
#include <stdio.h> #include <unikbd.h> int main(void) { KHAND kbdhandle; KBDNAME *kbd_name; ULONG mode = 0; VDKEY invdk; VDKEY outvdk; UniChar inchar; UniChar outchar; 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; } /**************************************************************************/ /* Translate following dead key and unicode to composite character tilde A*/ /**************************************************************************/ invdk = DK_TILDE; inchar = 0x0041; rc = UniTranslateDeadkey( kbdhandle, invdk, inchar, &outchar, &outvdk ); if ( rc != ULS_SUCCESS ) { printf("UniTranslateDeadkey error: return code = %u\n", rc ); return 1; } return ULS_SUCCESS; }