Hi 

On windows 7 I have not managed to switch keyboard to dutch netherlands with 
below script. It does switch to US keyboard though. What am I doing wrong...? 

I have been experimenting with different parameters and so on. 

msdn also mentions ActivateKeyboardLayout but it does not appear in my 
win32api. 


import sys
sys.version
'2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]'

 python setkeyboard.py


win32api.GetLastError()=0
GetKeyboardLayout : 68355091 4130413
win32api.GetLastError()=0
67699721 4090409
win32api.GetLastError()=0
GetKeyboardLayout : 67699721 4090409
win32api.GetLastError()=0
67699721 4090409
GetKeyboardLayout :  67699721 4090409
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.


 type setkeyboard.py


import win32api,win32con,os

# 
kl=win32api.LoadKeyboardLayout('135464979',19|win32con.KLF_SETFORPROCESS|win32con.KLF_REORDER)
oldkl= win32api.GetKeyboardLayout()
print "win32api.GetLastError()=%s " % win32api.GetLastError()
print "GetKeyboardLayout : %s %x " % (oldkl,oldkl)


####
kl=win32api.LoadKeyboardLayout('8130813',19|win32con.KLF_SETFORPROCESS|win32con.KLF_REORDER)
print "win32api.GetLastError()=%s " % win32api.GetLastError()
print "%s %x " % (kl,kl)

curkl= win32api.GetKeyboardLayout()
print "win32api.GetLastError()=%s " % win32api.GetLastError()
print "GetKeyboardLayout : %s %x " % (curkl,curkl)

###
kl=win32api.LoadKeyboardLayout('135464979',19|win32con.KLF_SETFORPROCESS|win32con.KLF_REORDER)
print "win32api.GetLastError()=%s " % win32api.GetLastError()
print "%s %x " % (kl,kl)

curkl= win32api.GetKeyboardLayout()
print "GetKeyboardLayout :  %s %x " % (curkl,curkl)


os.system("cmd")



Kind Regards,
joe
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to