-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkeypad.go
51 lines (41 loc) · 1.24 KB
/
keypad.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package gdm
import (
"github.com/rogeecn/gdm/utils"
)
func (com *DmSoft) SendShortCut(vKey []int) {
for _, vkey := range vKey {
com.KeyDown(vkey)
}
for i := len(vKey) - 1; i >= 0; i-- {
com.KeyUp(vKey[i])
}
}
func (com *DmSoft) SetKeypadDelay(types string, delay int) bool {
ret, _ := com.dm.CallMethod("SetKeypadDelay", types, delay)
return utils.IsOK(ret.Val)
}
func (com *DmSoft) GetKeyState(vkCode int) bool {
ret, _ := com.dm.CallMethod("GetKeyState", vkCode)
return utils.IsOK(ret.Val)
}
func (com *DmSoft) KeyDown(vkCode int) bool {
ret, _ := com.dm.CallMethod("KeyDown", vkCode)
return utils.IsOK(ret.Val)
}
func (com *DmSoft) KeyPress(vkCode int) bool {
ret, _ := com.dm.CallMethod("KeyPress", vkCode)
return utils.IsOK(ret.Val)
}
// KeyPressStr指定的字符串序列,依次按顺序按下其中的字符
func (com *DmSoft) KeyPressStr(keyStr string, delay int) bool {
ret, _ := com.dm.CallMethod("KeyPressStr", keyStr, delay)
return utils.IsOK(ret.Val)
}
func (com *DmSoft) KeyUp(vkCode int) bool {
ret, _ := com.dm.CallMethod("KeyUp", vkCode)
return utils.IsOK(ret.Val)
}
func (com *DmSoft) WaitKey(vkCode int, timeOut int) bool {
ret, _ := com.dm.CallMethod("SetSimMode", vkCode, timeOut)
return utils.IsOK(ret.Val)
}