robotn / gohook

GoHook, Go global keyboard and mouse listener hook
MIT License
314 stars 44 forks source link

The output by hook event does not match the actual key pressed. #46

Closed saltfishh closed 9 months ago

saltfishh commented 9 months ago
func main(){
  evC := hook.Start()
    defer hook.End()
    for e := range evC {
        if e.Kind == 4 {
            log.Printf("%v", e)
          }
     }
}

2023/12/26 14:29:36 2023-12-26 14:29:36.906394194 +0800 CST m=+227.566967666 - Event: {Kind: KeyHold, Rawcode: 65293, Keychar: 65535} 2023/12/26 14:29:37 2023-12-26 14:29:37.006881198 +0800 CST m=+227.667454600 - Event: {Kind: KeyHold, Rawcode: 65505, Keychar: 65535} 2023/12/26 14:29:37 2023-12-26 14:29:37.107568162 +0800 CST m=+227.768141564 - Event: {Kind: KeyHold, Rawcode: 62, Keychar: 65535} 2023/12/26 14:29:37 2023-12-26 14:29:37.559345436 +0800 CST m=+228.219918838 - Event: {Kind: KeyHold, Rawcode: 32, Keychar: 65535}

Description

as you see , it will print the raw code when I press the key. but when I press the L key , the log shows me a assemble was pressed: ctrl+l , it's raw code is: 108. I have tried much times , all the rawCode shows me the ctrl key was pressed when I press any key.

Thanks!

saltfishh commented 9 months ago

my bad.