There are now many software having password input dialog box. The * identifier is displayed above. If you want to see its string and it is not difficult. Below we use Delphi to use the API function to develop a program that views its password character.
Function: The string is displayed in the specified place of the program when the mouse moves to the password.
Question 1: Find the control handle here when the mouse moves to the password dialog. This can be operated in this object. The specific implementation is as follows:
function gethwnd (): thandle; var hwnd: thandle; wndpoint: tpoint; begin try GetCursorPos (wndpoint); // Get the mouse pointer hwnd: = WindowFromPoint (wndpoint); Result: = wndpoint except Result: = 0; end; end;
Question 2: Get the password character of this object based on the acquired handle. The specific implementation is as follows:
Function getPass (VAR HWnd: Thandle): String; Var Passbuf: Integer; Passlong: long; begin passlong: = sendMessage (hwnd, wm_gettextLength, 0, 0) 1; // Get this object Length getMem ( Passtext, passlong); // open up a memory area. The storage data length is Passlong passbuf: = longint (passtext); // Get the first address of this data area SendMessage (HWND, WM_GETTEXT, PASSLONG, PASSBUF); // Send a message Let this object store the password data into the first address as Passbuf Data area. Deposit length is Passlong Result: = passText;
Such a major problem is solved. You can also use the API function such as getClassName, getWindowText to read the class, title, etc. of this object. The following is the source code, passed in Delphi6.0 WinXP test, for reference only.
{------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------------} Unit getWnd;
Interface
Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, ExtCtrls, Menus
type TForm1 = class (TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Timer1: TTimer; Label5: TLabel; Label6: TLabel; PopupMenu1: TPopupMenu; N1: TMenuItem; Shape1: TShape; Shape2: TShape ; Shape3: TShape; Shape4: TShape; N2: TMenuItem; procedure Timer1Timer (Sender: TObject); procedure N1Click (Sender: TObject); procedure FormMouseDown (Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer) ; procedure FormMouseUp (Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure FormMouseMove (Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure FormCreate (Sender: TObject); procedure N2Click (Sender: TObject); private {Private declarations} public procedure Createparams (var Params: TCreateParams); override; {public declarations} end; var Form1: TForm1; hwnd, htemp: THandle; point, mouse: TPoint; wndcaption: array [0..255] of char; w Ndclass: array [0..255] of char; fmove: boolean;
IMPLEMentation
{$ R * .dfm}
procedure TForm1.Timer1Timer (Sender: TObject); var buf: integer; ret: longint; mText: PChar; begin GetCursorPos (point); htemp: = WindowFromPoint (point); if hwnd <> htemp then begin hwnd: = htemp; GetClassName (HWND, WNDCLASS, 256); getWindowText (hwnd, wndcaption, 256); if wndcaption = '' Then Begin Ret: = SendMessage (HWND, WM_GETTEXTLENGTH, 0, 0) 1; GetMem (MTEXT, RET); BUF: = Longint (mText); SendMessage (HWND, WM_GETTEXT, RET, BUF); label4.caption: = mtext; end else label4.caption: = WNDCAPTION; label3.caption: = INTOSTR (hwnd); label6.caption: = WNDClass; end ;
Procedure TFORM1.N1CLICK (Sender: TOBJECT); Begin Close;
Procedure TForm1.FormMousedown (Sender: Tobject; Button: TMouseButton; Shift: tshiftstate; x, y: integer; begin fmove: = true; mouse.x: = x; mouse.y: = y;
Procedure TForm1.FormMouseup (Sender: Tobject; Button: tmousebutton; shift: tshiftstate; x, y: integer; begin fmove: = false;
Procedure TForm1.Formousemove (Sender: Tobject; Shift: TshiftState; x, y: integer); begin if fmove dam: = top y-mouse.y; left: = left x-mouse.x; end; end; ;
Procedure TFORM1.FORMCREATE (Sender: Tobject); Begin Left: = Screen.Width-Width-3; Top: = Screen.Height-Height-34; End;
procedure TForm1.Createparams (var Params: TCreateParams); var wndParnet: THandle; begin Inherited CreateParams (Params); With Params do begin EXStyle: = ExStyle or WS_EX_TOPMOST OR WS_EX_ACCEPTFILES; wndParnet: = GetDesktopWindow; end; end;
Procedure tform1.n2click (sender: TOBJECT); begin Timer1.enabled: = not time1.enabled; if Timer1.enabled the n2.caption: = 'Pause' else n2.caption: = 'Start'; end; end. { -------------------------------------------------- ----------------------}
{--------------------------------------- -------------------} Object Form1: tform1 left = 308 TOP = 302 bordersty = bsnone caption = 'xiewh_open' clientHeight = 59 ClientWidth = 179 color = CLBTNFACE FONT.CHARSET = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PopupMenu = PopupMenu1 OnCreate = FormCreate OnMouseDown = FormMouseDown OnMouseMove = FormMouseMove OnMouseUp = FormMouseUp PixelsPerInch = 96 TextHeight = 13 object Shape1: TShape Left = 0 Top = 0 Width = 179 Height = 2 Align = alTop Pen.Color = clBlue OnMouseDown = FormMouseDown OnMouseMove = FormMouseMove OnMouseUp = FormMouseUp end object Label1: TLabel Left = 8 Top = 11 Width = 57 Height = 13 autosize = false capen = # 21477 # 26564 # 65306 transparent = true end object label2: TLabel Left = 8 TOP = 26 width = 64 height = 13 autosize = false Caption = # 26631 # 39064 # 21517 # 65306 Transparent = True end object Label3: TLabel Left = 56 Top = 12 Width = 117 Height = 13 AutoSize = False Transparent = True end object Label4: TLabel Left = 56 Top = 25 Width = 117 Height = 13 autosize = false transparent = true end object label5: TLabel Left = 8 TOP = 40 width = 56 height = 13 caption = # 31867 # 12288 # 21517 # 65306 transparent =
True end object Label6: TLabel Left = 56 Top = 39 Width = 117 Height = 13 AutoSize = False Transparent = True end object Shape2: TShape Left = 0 Top = 0 Width = 2 Height = 73 Pen.Color = clActiveCaption Pen.Width = 2 end object Shape3: TShape Left = 0 Top = 57 Width = 179 Height = 2 Align = alBottom Pen.Color = clBlue Pen.Width = 2 end object Shape4: TShape Left = 177 Top = -1 Width = 2 Height = 71 Pen .Color = clBlue Pen.Width = 2 end object Timer1: TTimer Interval = 100 OnTimer = Timer1Timer Left = 120 Top = 32 end object PopupMenu1: TPopupMenu Left = 88 Top = 32 object N2: TMenuItem Caption = # 26242 # 20572 OnClick = N2Click End Object N1: TMenuItem CAPTION = # 36864 # 20986 Onclick = n1click end limited {------------------------------- -----------------------------------------}