Answered by:
Wrong Keyboard Layout When Started from a Service

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
Answers
-
I'd probably ask over here.
http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?category=windowsdesktopdev
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.- Proposed as answer by Just Karl Friday, April 4, 2014 8:09 PM
- Marked as answer by Dave PatrickMVP Sunday, April 6, 2014 2:11 PM
Sunday, March 30, 2014 11:34 PM
All replies
-
Hi Steve,
Welcome to msdn forum.
Here are some references:
Enable keyboard layouts for different languages
How to change keyboard language in Windows
How to Change Your Keyboard from American to English
This forum is to discuss problems of Application Compatibility for Windows Desktop Development . Your question is not related to the topic of this forum.
Hey, Could ya read this before posting to this forum? (plus main support link)
Hope this helps you.
Best Regards,
Eileen
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Monday, March 24, 2014 1:53 AM -
Completely useless response!
I didn't have a specific forum in context when I created the question so I didn't see the sticky detailing what this forum was for. Maybe you could suggest the appropriate forum for this question?
Monday, March 24, 2014 1:45 PM -
I'd probably ask over here.
http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?category=windowsdesktopdev
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.- Proposed as answer by Just Karl Friday, April 4, 2014 8:09 PM
- Marked as answer by Dave PatrickMVP Sunday, April 6, 2014 2:11 PM
Sunday, March 30, 2014 11:34 PM