GetKeyboardLayoutName Win32API

Tim Golden mail at timgolden.me.uk
Sun Feb 15 10:53:24 CET 2009


Tsolakos Stavros wrote:
> Hi all.
> 
> I was trying to find a way to read the currently selected input layout
> from an app written in python. I am aware that if the app were written
> in C, I would have to call the GetKeyboardLayoutName() function. How can
> this be done in Python? I want to avoid writing an extension just for
> this. The function is not available through pywin32.

<code>
import ctypes

s = ctypes.create_unicode_buffer (1024)
ctypes.windll.user32.GetKeyboardLayoutNameW (s)

print s.value

</code>

TJG



More information about the Python-list mailing list