Check status of special keys/de
Zurück zur Seite Code Beispiele.
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;
...From the Free Pascal wiki, page "Check status of special keys/de", as it stood on 2020-02-10 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Edited on wiki.freepascal.org by 3 people, 2013–2020
From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.
| When | Who | What changed |
|---|---|---|
| Olaf | Created page | |
| Olaf | (minor) | |
| Olaf | (minor) | |
| Olaf | (minor) | |
| FTurtle | ||
| Trev | Fixed syntax highlighting; deleted category already in page template (minor) |
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
