mirror of
https://github.com/robotn/gohook.git
synced 2024-11-24 21:36:50 +08:00
41 lines
399 B
Go
41 lines
399 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/robotn/gohook"
|
||
|
)
|
||
|
|
||
|
func add() {
|
||
|
s := hook.Start()
|
||
|
defer hook.End()
|
||
|
|
||
|
ct := false
|
||
|
for {
|
||
|
i := <-s
|
||
|
|
||
|
if i.Kind == hook.KeyHold && i.Rawcode == 59 {
|
||
|
ct = true
|
||
|
}
|
||
|
|
||
|
if ct && i.Rawcode == 12 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func base() {
|
||
|
EvChan := hook.Start()
|
||
|
defer hook.End()
|
||
|
|
||
|
for ev := range EvChan {
|
||
|
fmt.Println(ev)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
base()
|
||
|
|
||
|
add()
|
||
|
}
|