unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
hotkeyid :integer;
procedure WMhotkeyhandle(var msg:Tmessage);
message wm_hotkey;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Wmhotkeyhandle
(var msg:Tmessage);
begin
if (msg.LParamHi=$41) and
(msg.lparamLo=MOD_CONTROL or mod_Alt) then
begin
msg.Result:=1;
application.BringToFront;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
hotkeyid:=GlobalAddAtom(pchar('UserDefineHotKey'))-$C000;
registerhotkey(handle,hotkeyid,MOD_CONTROL or mod_Alt,$41);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
unregisterhotkey(handle,hotkeyid);
DeleteAtom(HotKeyID);
end;
end.