Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get Windows Current Input Locale

Posted on 1998-10-15
5
Medium Priority
?
537 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 800 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

722 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