Código
var
WndHint: THintWindow = nil; // declare a variável fora da procedure
procedure TForm1.Timer1Timer(Sender: TObject);
var
Pos: TPoint;
HWin: THandle;
Paswd: array[0..63] of Char;
R: TRect;
begin
GetCursorPos(Pos);
HWin := WindowFromPoint(Pos);
if SendMessage(HWin, EM_GETPASSWORDCHAR, 0, 0) <> 0 then
begin
if WndHint = nil then
begin
WndHint := THintWindow.Create(Self);
WndHint.Color := clInfoBk;
SendMessage(HWin, WM_GETTEXT, 64, Longint(@Paswd));
R := Rect(Pos.X, Pos.Y + 18, Pos.X +
WndHint.Canvas.TextWidth(Paswd) + 8,
Pos.Y + 18 + WndHint.Canvas.TextHeight(Paswd));
WndHint.ActivateHint(R, Paswd);
end;
end
else if WndHint <> nil then
begin
WndHint.ReleaseHandle;
WndHint := nil;
end;
end;
Está pronto! Agora basta você executar a aplicação e mante-la minimizada. Quando parar o ponteiro do mouse sobre o Edit que contém o misterioso "********" você verá um Hint informando qual é a senha que foi digitada.
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009