Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: Delphi | Size: 0.81 KB | Hits: 88 | Expires: Never
Copy text to clipboard
  1. function GetKeyCode(c: char): integer;
  2. begin
  3.   result := VkKeyScan(c) and $FF;
  4. end;
  5.  
  6. function StrToChr(Str: string; Pos: Integer): Char;
  7. begin
  8.   Result := Str[Pos];
  9. end;
  10.  
  11. function aKeyDown(var Key: Byte): Boolean; stdcall;
  12. var
  13.   TheKeys: string;
  14.   I: Byte;
  15. begin
  16.   Result := False;
  17.   TheKeys := '1234567890qwertyuiopasdfghjkl' + Chr(13) + 'zxcvbnm ' + Chr(8);
  18.   for I := 1 to Length(TheKeys) do
  19.   begin
  20.     Key := GetKeyCode(StrToChr(TheKeys, I));
  21.     if (GetAsyncKeyState(Key) <> 0) then
  22.     begin
  23.       Result := True;
  24.       Exit;
  25.     end;
  26.   end;
  27.   TheKeys := '`-=[]\;../';
  28.   for I := 1 to Length(TheKeys) do
  29.   begin
  30.     Key := Ord(GetKeyCode(StrToChr(TheKeys, I)));
  31.     if (GetAsyncKeyState(Key) <> 0) then
  32.     begin
  33.       Result := True;
  34.       Exit;
  35.     end;
  36.   end;
  37.   Key := 0;
  38. end;