Home All Groups Group Topic Archive Search About

SendKeys problem when using Non-English Windows keyboard layouts

Author
27 Jul 2006 9:31 PM
davermcl
Hi,

I'm experiencing a problem when using the VB SendKeys method.  I'm
sending characters to a textbox in another application.  It works fine
when the Windows Input Languages on both apps are set to English, but
if they are set to say German, I'm getting the wrong characters in my
client textbox.

This is my SendKeys statement:
SendKeys.Send(MyString)


Thanks in advance,

davidm

Author
28 Jul 2006 2:47 PM
Claes Bergefall
The docs for SendKeys.Send says that you should avoid it in applications
intended for international use since it can lead to unpredictable results.
Guess you just proved that :-(.

That being said, I have successfully used it with a bunch of different
keyboard layouts. However I only sent international characters, so I guess
it depends on what characters you're actually trying to send. Do you have to
send the actual keystrokes? If all you want to do is set the text in the
textbox there are other ways (see WM_SETTEXT)

  /claes


<daver***@hotmail.com> wrote in message
Show quoteHide quote
news:1154035884.769852.295260@m79g2000cwm.googlegroups.com...
> Hi,
>
> I'm experiencing a problem when using the VB SendKeys method.  I'm
> sending characters to a textbox in another application.  It works fine
> when the Windows Input Languages on both apps are set to English, but
> if they are set to say German, I'm getting the wrong characters in my
> client textbox.
>
> This is my SendKeys statement:
> SendKeys.Send(MyString)
>
>
> Thanks in advance,
>
> davidm
>
Author
28 Jul 2006 3:00 PM
Claes Bergefall
That should say "...I only sent standard English characters (i.e. 7-bit
ASCII)..."

  /claes

Show quoteHide quote
"Claes Bergefall" <louplou@nospam.nospam> wrote in message
news:%23bahVRlsGHA.4596@TK2MSFTNGP04.phx.gbl...
> The docs for SendKeys.Send says that you should avoid it in applications
> intended for international use since it can lead to unpredictable results.
> Guess you just proved that :-(.
>
> That being said, I have successfully used it with a bunch of different
> keyboard layouts. However I only sent international characters, so I guess
> it depends on what characters you're actually trying to send. Do you have
> to send the actual keystrokes? If all you want to do is set the text in
> the textbox there are other ways (see WM_SETTEXT)
>
>  /claes
>
>
> <daver***@hotmail.com> wrote in message
> news:1154035884.769852.295260@m79g2000cwm.googlegroups.com...
>> Hi,
>>
>> I'm experiencing a problem when using the VB SendKeys method.  I'm
>> sending characters to a textbox in another application.  It works fine
>> when the Windows Input Languages on both apps are set to English, but
>> if they are set to say German, I'm getting the wrong characters in my
>> client textbox.
>>
>> This is my SendKeys statement:
>> SendKeys.Send(MyString)
>>
>>
>> Thanks in advance,
>>
>> davidm
>>
>
>
Author
28 Jul 2006 6:51 PM
davermcl
Thanks for your response!

yes I do want to send the actual keystrokes in order to simulate a
physical keyboard.

Usually only 2-3 ASCII characters display incorrectly when using
non-English layouts. I just thought there may be a workaround for this
problem.

But I might have to resort to the 'keybd_event' API call which I would
like to avoid because SendKeys works great in all other aspects of our
application such as sending text to a textbox within the same
application.

davidm
Author
1 Aug 2006 1:49 PM
Mini-Tools Timm
"daver***@hotmail.com" wrote:

> Hi,
>
> I'm experiencing a problem when using the VB SendKeys method.  I'm
> sending characters to a textbox in another application.  It works fine
> when the Windows Input Languages on both apps are set to English, but
> if they are set to say German, I'm getting the wrong characters in my
> client textbox.

You need to change the keyboard layout of the sending application to match
the keyboard layout of the focused application.

We offer a .NET component FREE for non-commercial use that will work great
with non-English keyboards (except for complex keyboards which require IME):

http://www.mini-tools.com/goto/input

--
Timm Martin
Mini-Tools
..NET Components and Windows Software
http://www.mini-tools.com