.netautomationspecial-characterskeykeyboard-hook

keybd_event, special characters and keyboard layouts?


I'm developing a C# .net application that allows users to insert text and have the appliaction automatically type it. What it does is parse every character of this text and send every keystroke seperatly.

However, I am wondering if there's a way to actually know what the output will be. For example,

However, I am a little worried about special characters and keyboard layouts.

For reference, I found this page with the key codes: http://msdn.microsoft.com/en-us/library/ms927178.aspx

This page has the folloing lines:

VK_OEM_5 = "\|" for US
VK_OEM_102 = "<>" or "\|" on RT 102-key keyboard

Now, if my text conains a '\', how do I know if I have to send VK_OEM_5 or VK_OEM_102?

Thanks!


Solution

  • Why don't you just send WM_CHARs to the target window? This works with most programs(usually only games have problems with it). That way you circumvent the keyboard layout problem completely.