Solved

Get Windows Current Input Locale

Posted on 1998-10-15
5
513 Views
Last Modified: 2006-11-17
My user is running US English version of Windows NT with several Input Locales (Keyboard languages) installed. How can I programmatically find out which Input Locale is current, and how my application can detect when the Input Locale changes. Using GetSystemDefaultLCID or GetSystemDefaultLangID APIs (no matter) I can only obtain the default Windows language, not the one currently in use.
0
Comment
Question by:tbbrhun
  • 3
  • 2
5 Comments
 

Author Comment

by:tbbrhun
ID: 1440141
Edited text of question
0
 
LVL 2

Expert Comment

by:Poddy
ID: 1440142
The function you seek is GetKeyboardLayout

Pass zero as its parameter (indicating current thread)

the low word is the input language locale
the hi word is the physical layout
(these may be the same)
0
 

Author Comment

by:tbbrhun
ID: 1440143
Poddy, can you be a little more specific about the low and high words and how to work with them after the API executed. I'm not really getting the your answer, but it looks like you know what you are talking about. I'd like to hear more from you.
0
 
LVL 2

Accepted Solution

by:
Poddy earned 200 total points
ID: 1440144
dim lngRet as long
dim lngHi as long
dim lngLo as long

lngRet=GetKeyboardLayout(0)
lngHi=lngRet \ 65536
lngLo=lngRet mod 65536

specifically, the return value is a 4 byte value:
The high word is the first two bytes and the low word is the second pair.

So to extract the high word, divide the result by 65536 (2 ^16)
and to extract the low word, take the remainder (MODulo) of this division.  

So if you set up a keyboard with US Language in British layout, the return values will be 2057 in the high word and 1033 in the low word.

2057 (&H0809)is the locale ID for British English
1033 (&H0409)is the locale ID for US English


any questions...?
0
 

Author Comment

by:tbbrhun
ID: 1440145
Hey Poddy! By the time I got it I figured it out myself, but you get your points anyway, THANKS. That solves half of my problem. Now, is there any way to detect in my application when the user changes the locale. I would spend another 100 point for that. Please respond to BDH4628@ix.netcom.com. If you have the solution, I will re-submit the question through Exchange for you to get points. THANKS again!!!!!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now