procedure TForm1.Timer1Timer(Sender: TObject);
var
Pos : TPoint;
Handle : HWND;
Buf : array[0..1024] of Char;
passmark : Integer;
begin
// GetCursorPos(Pos);
// Handle := WindowFromPoint(Pos);
Handle := Edit1.Handle;
GetClassName(Handle, Buf, 1024);
passmark := SendMessage(Handle, EM_GETPASSWORDCHAR, 0, 0);
if passmark <> 0 then
begin
postmessage(Handle, EM_SETPASSWORDCHAR, 0, 0);
SendMessage(Handle, WM_GETTEXT, 1024, Integer(@Buf));
postmessage(Handle, EM_SETPASSWORDCHAR, wparam(ord('*')), 0);
end
else
SendMessage(Handle, WM_GETTEXT, 1024, Integer(@buf));
Edit2.Text := Buf;
end;