Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<!--StartFragment--><CODE>type TForm1 = class (TForm) Edit1: TEdit; ActionList1: TActionList; Action1: TAction; Label1: TLabel; procedure Action1Execute(Sender: TObject); procedure FormCreate(Sender: TObject); private public { Ajouter cette procédure} procedure ApplicationMessage(var Msg: TMsg; var Handled: boolean); end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Action1Execute(Sender: TObject); begin Label1.Caption : = 'Evènement intercepté'; end; procedure TForm1.ApplicationMessage(var Msg: TMsg; var Handled: boolean); var Shift: TShiftState; KeyState: TKeyboardState; begin //Etat du clavier GetKeyboardState(KeyState); //Etat des touches shift, ctrl, alt Shift := KeyboardStateToShiftState(KeyState); case Msg.message of WM_KEYUP: //relâchement des touches CTRL+F4 if (ssCtrl in Shift) and (Msg.WParam = VK_F4) then begin Edit1.SetFocus; Edit1.Text := Edit1.Text + ' CTRL+F4'; //ok, le message est traité Handled := True; end ; WM_KEYDOWN: //Enfoncement des touches CTRL+F4 if (ssCtrl in Shift) and (Msg.WParam = VK_F4) then Handled := True; end ; end; procedure TForm1.FormCreate(Sender: TObject); begin Application.OnMessage : = ApplicationMessage; end;