[python-win32] How can I use GetKeyboardLayout in python?

Tim Golden mail at timgolden.me.uk
Wed Aug 27 15:40:54 CEST 2008


Dror Cohen wrote:
> Hi everybody, for a long time I'm trying to get my current typing 
> language in windows.
> At the moment I'm thinking about using either GetKeyboardLayout or 
> ITfInputProcessorProfiles that holds the **GetCurrentLanguage* 
> <http://msdn.microsoft.com/en-us/library/ms628562%28VS.85%29.aspx> function.
> It seems that using GetKeyboardLayout will be a lot easier but I just 
> can't find this function in the win32api functions list.

I freely admit I know next to nothing about this aspect of
Windows, but to help you along, it's nearly trivial to
access this function via ctypes:

<code>
import ctypes

print ctypes.windll.user32.GetKeyboardLayout (0)

</code>

You then have the issue of what to do with the result,
but I'm sure you're up to that challenge.

TJG


More information about the python-win32 mailing list