Avatar of Mortaza Doulaty
Mortaza DoulatyFlag for United Kingdom of Great Britain and Northern Ireland asked on

Get Keyboard Layout Name Of Active Window

I need to get the layout name of active window.
Calling GetKeyboardLayoutName API from my app, only gets the layout name of the app itself.
As far as I know, every open window, can have it's own active layout. So changing keyboard layout from one windows, does not make any change to the code returned from GetKeyboardLayoutName function in my app, but when in my app's active windows, I change keyboard layout, it catches the layout change code.

All I need if to find the current keyboard layout name (for example windows returns 409 for English keyboard) of the current active window.
Visual Basic Classic

Avatar of undefined
Last Comment
Mortaza Doulaty

8/22/2022 - Mon
Mortaza Doulaty

GetKeyboardLayout is what I need.
But this function requires the ThreadID of the active window.
How can I get the thread id of active window?
Mortaza Doulaty

This might help me:
1. GetForegroundWindow() to get the active window
2. GetWindowsThreadProcessID() to get the thread ID of the thread that owns the window
Mortaza Doulaty

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.