发信人: makoto.g(Makoto)
整理人: winsy(2003-03-05 15:56:15), 站内信件
|
'只有一个窗体,窗体上有一个标签lblPassWord用于显示被获取的密码.一个PictureBox,Name=picIcon里面可放上你喜欢的图片,用于获取活动的密码框
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Dim m_Captured As Boolean
Private Sub Form_Load()
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim tPoint As POINTAPI
Dim hWin As Long
Dim str As String * 100
Dim txt(50) As Byte
Dim i As Long
If Not m_Captured Then Exit Sub
GetCursorPos tPoint
If x < 0 Or y < 0 Or x > Me.ScaleWidth Or y > Me.ScaleHeight Then
hWin = WindowFromPoint(tPoint.x, tPoint.y)
GetClassName hWin, str, 100
If InStr(1, str, "Edit", vbTextCompare) <> 0 Or InStr(1, str, "TextBox", vbTextCompare) Then
SendMessage hWin, &HD, 50, txt(0)
lblPassWord = ""
For i = 0 To 50
If txt(i) = 0 Then
Exit For
Else
lblPassWord = lblPassWord & Chr(txt(i))
End If
Next i
ElseIf lblPassWord <> "" Then
lblPassWord = ""
End If
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
ReleaseCapture
m_Captured = False
End Sub
Private Sub picIcon_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
SetCapture Me.hwnd
m_Captured = True
End Sub
'运行时,在你的PicIcon上按下鼠标左键不放,拖动它到有密码的文本框上(通常这个文本框是以****表示的)就可以在lblPassWord中你就可以看到这些**的真实面目.
---- Microsoft Visual Basic
████【G】████TM
█ █
█ Makoto █
█ 无敌VB签名 █ 无法想象没有VB的世界,我怎样活下去
█ █ I Only Love Visual Basic !
███████████
kinki-kids@GZ Forever 本签名仅适用于新广州社区-VB和Basic版
███████████ 版权所有(C) 2001年Makoto全部保留.
|
|