How to send Scandinavian letters using SendInput

I am trying to create a virtual keyboard that mimics the keyboard using the SendInput method as follows:

        public static void SendKeyDown(System.Windows.Forms.Keys key)
        {
            INPUT k = new INPUT();
            k.type = (int)InputType.INPUT_KEYBOARD;
            k.ki.wVk = (short)key;
            k.ki.dwFlags = (int)KEYEVENTF.KEYDOWN;
            k.ki.dwExtraInfo = GetMessageExtraInfo();

            SendInput(1, new INPUT[] { k }, Marshal.SizeOf(k));
        }

But I can not find the Scandinavian letters Ä, Ö and Å from the Keys-Liberation. How to send these letters using the SendInput method?

+2
source share
2 answers

You can send Unicode characters with KEYEVENTF_UNICODE.

k.type = (int)InputType.INPUT_KEYBOARD;
k.ki.wScan = 'ö';
k.ki.wVk = 0;
k.ki.dwFlags = (int)KEYEVENTF.UNICODE | (int)KEYEVENTF.KEYDOWN;
k.ki.dwExtraInfo = GetMessageExtraInfo();

This is more portable than your solution using Oem3et al, whose assigned symbol will differ depending on the culture of the platform on which your application is running.

(The remaining P / Invoke entries can be found in another answer.)

+4
source

Found a solution on my own:

Oem3 = ö, Oem7 = ä, Oem6 = å

0

All Articles