| View previous topic :: View next topic |
| Author |
Message |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sun Jan 27, 2008 8:35 am Post subject: check which key pressed |
|
|
i was wondering if anyone knew how to check if a key is begin pressed in delphi, so say i press a button and it waits for a key to be pressed, and then it records it to a variable _________________
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sun Jan 27, 2008 8:52 am Post subject: |
|
|
if odd(GetAsyncKeyState(VK_F1)) then
//code
checks if F1 is pressed
useally used in TTimer |
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Mon Jan 28, 2008 12:18 am Post subject: |
|
|
what i need to do is have a timer that waits for any key to be pressed so it can record _________________
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Mon Jan 28, 2008 12:53 am Post subject: |
|
|
RegisterHotkey and then handle WM_HOTKEY messages. _________________
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Mon Jan 28, 2008 8:45 am Post subject: |
|
|
Try this:
| Code: |
for I := 0 to $255 do
if odd(GetAsyncKeyState(i)) then
begin
{Code here...}
end;
|
|
|
| Back to top |
|
 |
Deine Mutter Expert Cheater
Reputation: 1
Joined: 05 Apr 2006 Posts: 181
|
Posted: Mon Jan 28, 2008 2:28 pm Post subject: |
|
|
wndproc? Oo _________________
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Mon Jan 28, 2008 6:21 pm Post subject: |
|
|
| HolyBlah wrote: | Try this:
| Code: |
for I := 0 to $255 do
if odd(GetAsyncKeyState(i)) then
begin
{Code here...}
end;
|
|
Registering hotkeys is much better. _________________
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Mon Jan 28, 2008 6:30 pm Post subject: |
|
|
| sponge wrote: | | Registering hotkeys is much better. |
Yes but he wants to record a key.
So would have to register all keys then. |
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Mon Jan 28, 2008 7:44 pm Post subject: |
|
|
oh nvm then. the first part stated that he wnated to know if a key was being pressed. _________________
|
|
| Back to top |
|
 |
|