Search Tools Links Login

SnadBoy Imitator (Password Unmasker)


You've all seen the *'s that are used to hide passwords. This program reveals the text behind these stars. Extremely easy to follow, only 19 lines of code, including API declarations. Easy enough for an intermediate beginner.

Original Author: Matt Fredrikson

Assumptions

Create one textbox named Text1 and one timer named Timer1.

Code

'(C) Copyright 1999 Matt Fredrikson
Private Declare Function WindowFromPoint Lib "user32.dll" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Private Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINT_TYPE) As Long
Private Type POINT_TYPE
x As Long
y As Long
End Type
Private Const WM_GETTEXT = &HD
Private Const TXT_LEN = 100
Private Sub Timer1_Timer()
Dim ppoint As POINT_TYPE
Dim ttxt As String
ttxt = Space(100) 'Give space for window text
errval = GetCursorPos(ppoint) 'Get Cursor Point
thwnd = WindowFromPoint(ppoint.x, ppoint.y) 'Get window handle of window under cursor
errval = SendMessage(thwnd, WM_GETTEXT, ByVal TXT_LEN, ByVal ttxt) 'Get text of that window
ttxt = RTrim(ttxt) 'Remove Spaces
Text1.Text = ttxt 'Display results
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 126 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.