Check status of special keys/de

From Free Pascal wiki
Revision as of 08:40, 26 January 2014 by Olaf (talk | contribs)
Jump to navigationJump to search

Deutsch (de)

Zurück zur Seite Zusätzliche Informationen.

Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.
Die Prozeduren ermitteln den Status der Tasten:

  • Caps Lock oder Shift Lock oder Umschaltsperre oder Feststelltaste
  • Insert oder Einfügen-Taste
  • Num Lock oder Num-Taste oder Num-Lock-Taste
  • Scroll Lock oder Rollen-Taste oder Scroll-Lock-Taste


Beispiel:

uses
  Windows, ...;

   ...

function funLowOrderBitSet(intWert: integer): boolean; inline;
begin
  Result := (intWert and 1 > 0);
end;



// ermittelt, ob die Caps-Lock-Taste aktiv ist
function funCapsLock: boolean;
begin
  Result := funLowOrderBitSet(GetKeyState(VK_CAPITAL));
end;



// ermittelt, ob die Einfügen-Taste aktiv ist
function funInsertOn: boolean;
begin
  Result := funLowOrderBitSet(GetKeyState(VK_INSERT));
end;



// ermittelt, ob die Num-Lock-Taste aktiv ist
function funNumLock: boolean;
begin
  Result := funLowOrderBitSet(GetKeyState(VK_NUMLOCK));
end;



// ermittelt, ob die Scoll-Lock-Taste aktiv ist
function funScrollLock: boolean;
begin
  Result := funLowOrderBitSet(GetKeyState(VK_SCROLL));
end;
  
  ...



--Olaf 07:51, 2 June 2013 (UTC)