Wrong Keyboard Layout When Started from a Service RRS feed

  • Question

  • I have an application that creates a report and emails it to a recipient name typed in by the user. On top of this we have built an automation layer so the report can be scheduled to run a specific times and email the same recipient each time. This is achieved by recording the windows messages received in a file and using PostMessage to play them back later. This works without a problem when run by the logged in user but fails when started from a service that is logged on with the same user account. The re-play of the recipient email address changes from recipient_nam@domain.com to recipient_name~domain.com

    The '@' symbol in the email address is being replaced with a '~' which I believe is due to the keyboard layout in use when started from a service. The @ symbol has a virtual key code of VK_OEM_3 on an English UK keyboard but on an English US keyboard that corresponds to the key under the 'Esc' key and that, combined with shift, gives the '~' character. This is also backed up by calls to GetKeyboardLayout() which yield 0x0809 (United Kingdom (GB)) when launched by the user and 0x0409 (United States (US)) when launched by the service logged on as the same user account.

    All of the language and regional settings I can find are showing as English UK. Where could the English US keyboard layout be picked up from? Can I force the layout to English UK?

    • Moved by Eileen ni Tuesday, March 25, 2014 1:51 AM
    Thursday, March 20, 2014 9:24 AM


All replies