#多线程#【问题】有时候按(两下)才能检测到,按的第一下不记录。
Dimenv 线程ID1, 线程ID2
线程ID1 = BeginThread(鼠标) '记录 鼠标
线程ID2 = BeginThread(键盘) '记录 键盘
Do
Delay 200
Loop
Function 鼠标()
Do
M=WaitClick() '等待按 任意鼠标
GetCursorPos mx,my '记录 鼠标坐标
If M = 32769 Then
TracePrint "左"&M
TracePrint mx&","&my
ElseIf M = 32773 then
TracePrint "右"&M
TracePrint mx&","&my
End If
delay 100
M=""
Loop
End Function
Function 键盘()
Do
key=WaitKey() '等待按 任意按键
TracePrint key
Delay 100
Key=""
Loop
End Function
Dimenv 线程ID1, 线程ID2
线程ID1 = BeginThread(鼠标) '记录 鼠标
线程ID2 = BeginThread(键盘) '记录 键盘
Do
Delay 200
Loop
Function 鼠标()
Do
M=WaitClick() '等待按 任意鼠标
GetCursorPos mx,my '记录 鼠标坐标
If M = 32769 Then
TracePrint "左"&M
TracePrint mx&","&my
ElseIf M = 32773 then
TracePrint "右"&M
TracePrint mx&","&my
End If
delay 100
M=""
Loop
End Function
Function 键盘()
Do
key=WaitKey() '等待按 任意按键
TracePrint key
Delay 100
Key=""
Loop
End Function