Category: Miscellaneous
Title: Know if a key has been pressed
Author: Damian Cipolat
E-mail: Damian_Cipolat@hotmail.com
Date added: 02.06.2006
Hits: 3141
procedure TForm1.Button1Click(Sender: TObject);
var
hTaskBar : THandle;
begin
// If you want
to detect a letter you must be use the ascii code.
//detect the "a and the A letter".
if GetasyncKeyState(65)<>0
then Caption:='A';
if GetasyncKeyState(97)<>0
then Caption:='a';
// If you want
to detect the left button
of the mouse use:
if GetasyncKeyState(1)<>0 'mouse
end;
//To detect a hey you must be use the Virtua key codes..
if GetasyncKeyState(vk_space)<>0
then Caption:='Spacebar';