unit Unit14; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm14 = class(TForm) Timer1: TTimer; // réglé a 45ms Label1: TLabel; procedure Timer1Timer(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var Form14: TForm14; implementation {$R *.dfm} procedure TForm14.Timer1Timer(Sender: TObject); var S : String; begin S := ''; if GetAsyncKeyState(VK_UP) < 0 then S := S + 'UP '; if GetAsyncKeyState(VK_DOWN) < 0 then S := S + 'DOWN '; if GetAsyncKeyState(VK_LEFT) < 0 then S := S + 'LEFT '; if GetAsyncKeyState(VK_RIGHT) < 0 then S := S + 'RIGHT '; if GetAsyncKeyState(VK_SPACE) < 0 then S := S + 'SPACE '; if GetAsyncKeyState(VK_CONTROL) < 0 then S := S + 'CTRL '; if GetAsyncKeyState(VK_LCONTROL) < 0 then S := S + 'LEFTCTRL '; if GetAsyncKeyState(VK_RCONTROL) < 0 then S := S + 'RIGHTCTRL '; if GetAsyncKeyState(VK_SHIFT) < 0 then S := S + 'SHIFT '; if GetAsyncKeyState(VK_LSHIFT) < 0 then S := S + 'LEFTSHIFT '; if GetAsyncKeyState(VK_RSHIFT) < 0 then S := S + 'RIGHTSHIFT '; if GetAsyncKeyState(VK_RETURN) < 0 then S := S + 'ENTER '; if GetAsyncKeyState(VK_CAPITAL) < 0 then S := S + 'CAPSLOCK '; if GetAsyncKeyState(VK_BACK) < 0 then S := S + 'BACKSPACE '; if GetAsyncKeyState(VK_TAB) < 0 then S := S + 'TAB '; Label1.Caption := S; end; end.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question