unit ViewPassword_Unit;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Buttons;type
TForm1 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
BitBtn1: TBitBtn;
procedure Timer1Timer(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
ct:boolean;implementation{$R *.DFM}procedure TForm1.Timer1Timer(Sender: TObject);
var
p:tpoint;
h:hwnd;
begin
getcursorpos(p);
label1.Caption:='X= '+inttostr(p.x)+' Y= '+inttostr(p.y);
h:=windowfrompoint(p);
if iswindow(h) then
begin
sendmessage(h,em_setpasswordchar,0,0);
invalidaterect(h,nil,false);
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if ct then
begin
timer1.Enabled:=true;
bitbtn1.Caption:='&Stop';
end else
begin
timer1.Enabled:=false;
bitbtn1.Caption:='&Start';
end;
ct:=not ct;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Enabled:=false;
label1.Caption:='';
ct:=true;
end;{
function TfrmMain.GetPassword(Sender:TObject):string;
var
hWnd:THandle;
lpCurPos:TPoint;
lntLen:Longint;
pchPass:pchar;
begin
GetCursorPos(lpCurPos);//»ñÈ¡µ±Ç°Êó±êλÖÃ
hWnd:=WindowFromPoint(Sender);//»ñÈ¡µ±Ç°Êó±êλÖõĴ°¿Ú¾ä±ú
lntLen:=SendMessage(hWnd,WM_GETTEXTLENGTH,0,0);
//if GetWindowLong(hWnd,GWL_STYLE) and ES_PASSWORD <> 0 then //ÅжÏÊÇ·ñΪÃÜÂë¿ò
begin
GetMem(pchPass,lntLen+1);
if lntLen > 0 then
SendMessage(hWnd,WM_GETTEXT,lntLen+1,Integer(pchPass));//»ñÈ¡ÃÜÂë´®
Result:=String(pchPass);
FreeMem(pchPass,lntLen+1);
end;
end;
}end.
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Buttons;type
TForm1 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
BitBtn1: TBitBtn;
procedure Timer1Timer(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
ct:boolean;implementation{$R *.DFM}procedure TForm1.Timer1Timer(Sender: TObject);
var
p:tpoint;
h:hwnd;
begin
getcursorpos(p);
label1.Caption:='X= '+inttostr(p.x)+' Y= '+inttostr(p.y);
h:=windowfrompoint(p);
if iswindow(h) then
begin
sendmessage(h,em_setpasswordchar,0,0);
invalidaterect(h,nil,false);
end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if ct then
begin
timer1.Enabled:=true;
bitbtn1.Caption:='&Stop';
end else
begin
timer1.Enabled:=false;
bitbtn1.Caption:='&Start';
end;
ct:=not ct;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Enabled:=false;
label1.Caption:='';
ct:=true;
end;{
function TfrmMain.GetPassword(Sender:TObject):string;
var
hWnd:THandle;
lpCurPos:TPoint;
lntLen:Longint;
pchPass:pchar;
begin
GetCursorPos(lpCurPos);//»ñÈ¡µ±Ç°Êó±êλÖÃ
hWnd:=WindowFromPoint(Sender);//»ñÈ¡µ±Ç°Êó±êλÖõĴ°¿Ú¾ä±ú
lntLen:=SendMessage(hWnd,WM_GETTEXTLENGTH,0,0);
//if GetWindowLong(hWnd,GWL_STYLE) and ES_PASSWORD <> 0 then //ÅжÏÊÇ·ñΪÃÜÂë¿ò
begin
GetMem(pchPass,lntLen+1);
if lntLen > 0 then
SendMessage(hWnd,WM_GETTEXT,lntLen+1,Integer(pchPass));//»ñÈ¡ÃÜÂë´®
Result:=String(pchPass);
FreeMem(pchPass,lntLen+1);
end;
end;
}end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货