Ver Mensaje Individual
  #12  
Antiguo 15-07-2010
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.210
Reputación: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Si te interesa, tienes otra forma de realizar lo mismo pero no usando la API GetAsyncKeyState ni, por tanto, un Timer. Se trata de registrar un HotKey y asociarle un evento:

Código Delphi [-]
unit Unit1;
 
interface
 
uses Windows, Messages, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
 
type
 TForm1 = class(TForm)
  procedure FormCreate(Sender: TObject);
  procedure HotKey(var Message: TMessage); message WM_HOTKEY;
 end;
 
var Form1: TForm1;
 
implementation
 
{$r *.dfm}
 
procedure TForm1.FormCreate(Sender: TObject);
begin
 RegisterHotKey(Handle, 1, 0, VK_ADD);
end;
 
procedure TForm1.HotKey(var Message: TMessage);
begin
 if Message.WParam = 1 then
  begin
   Form1.FormStyle := fsStayOnTop;
  end;
end;
 
end.

Tu dirás cual método te conviene mejor.


Saludos.
Responder Con Cita