unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
private
{ Private declarations }
id1, id2, id3, id4: Integer;
procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMHotKey(var Msg: TWMHotKey);
begin
if Msg.HotKey = id4 then
ShowMessage(’Print Screen pressed !’);
end;
procedure TForm1.FormCreate(Sender: TObject);
// Different Constants from Windows.pas
const
MOD_ALT = 1;
MOD_CONTROL = 2;
MOD_SHIFT = 4;
MOD_WIN = 8;
VK_A = $41;
VK_R = $52;
VK_F4 = $73;
begin
// Globally trap the Windows system key “PrintScreen”
id4 := GlobalAddAtom(’Hotkey4′);
RegisterHotKey(Handle, id4, 0, VK_SNAPSHOT);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(Handle, id4);
GlobalDeleteAtom(id4);
end;
end.
0 Responses to “Linux : executer un script au demarrage”
Leave a Reply