/// <summary> /// Translates a virtual key to its character equivalent using the current keyboard layout /// </summary> /// <param name="virtualKeyCode"></param> /// <param name="scanCode"></param> /// <param name="fuState"></param> /// <param name="chars"></param> /// <returns></returns> public bool TryGetCharFromKeyboardState(KeyCode virtualKeyCode, int scanCode, ToUnicodeExFlags fuState, out string?chars) { var Layout = KeyboardLayout.Current(); //get the active keyboard layout return(TryGetCharFromKeyboardState(virtualKeyCode, scanCode, fuState, Layout, out chars)); }