模拟按键的问题
这是一段模拟按键的代码,不知道为什么要把字符转换成大写的(strKey = UCase(strKey)),我试了下,传"ceshishi"给strKey,它模拟的结果却是"cceshisshi",搞不懂,请大家帮忙解答。。
。
。
Public Function QQ_AutoPressKey(hWnd As Long, strKey As String)
Dim nLength As Long, VKey As Long, i As Long
strKey = UCase(strKey)
nLength = Len(strKey)
For i = 1 To nLength
VKey = Asc(Mid(strKey, i, 1))
Call AutoPressKey(VKey)
Next
End Function
Public Function AutoPressKey(VKey As Long)
keybd_event VKey, 0, 0, 0 '模拟键按下
keybd_event VKey, 0, KEYEVENTF_KEYUP, 0 '模拟键弹起
End Function
。
。
。