There's a very simple method.
Just use the GetAsyncKeyState-API:
PHP Code:
Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal nVirtKey As Keys) As Short
to use it just put this into a button or timer:
PHP Code:
If GetAsyncKeyState(ASCII Code of the Key) = -32767 Then

a link of ASCII keys F1-F12.