|
|
发表于 2006-7-19 13:29:00
|
显示全部楼层
Re:MIU/chery 老师你在哪呀,可以把上次代码讲解一遍吗
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
Dim i As Integer
For i=32 to 255
x = GetAsyncKeyState(i) '7
If x = -32767 Then
'Add he code what you will do
End If
Next i
End Sub
申明了函数后就不停的循环,Do...Loop也行,Timer也行,用了这个函数GetAsyncKeyState(要监视的按键的ASCII码)后会返回一个数,如果返回的不是0,那么就说明这个按键被按下了。然后要记录就记录,记录用文本文件
Open "C:\ABC.txt" For Output As #1
Print #1,txtRecord
Close #1
.................................................... |
|