If the keyboard is English, it prints one thing, if it is another, it prints something else.
Code: Select all
key := "/"
scKey := GetKeySC(key)
if(scKey){
scKey := Format("sc{:X}", scKey)
}else{
scKey := key
}
MsgBox scKey
Code: Select all
key := "/"
scKey := GetKeySC(key)
if(scKey){
scKey := Format("sc{:X}", scKey)
}else{
scKey := key
}
MsgBox scKey
Code: Select all
key := "/"
if key = "/" {
scKey := "sc35"
}
MsgBox scKey
Code: Select all
MsgBox "current language: " Format("sc{:x}", GetKeySC("/"))
MsgBox "english: " Format("sc{:x}", GetKeySCFromLang("/"))
; Get SC key for keyboard layout, default is english.
GetKeySCFromLang(key, langID := 0x4090409) {
currentLayout := DllCall("GetKeyboardLayout", "uint", 0) ; Save previous layout
DllCall("ActivateKeyboardLayout", "uptr", langID, "uint", 0) ; Set new keyboard layout
SC := GetKeySC(key) ; Get SC for new layout
DllCall("ActivateKeyboardLayout", "uptr", currentLayout, "uint", 0) ; revert to previous layout
return SC
}
Users browsing this forum: jaccotjuhhh, lukepker, mikeyww, sanmaodo and 67 guests