Sign in Join
Wiki copytemporary

Check status of special keys/de: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Check status of special keys/de

OldNewLine
1+Zurück zur Seite [[code examples/de|Code Beispiele]].
2+
3+Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.
4+
5+Die Prozeduren ermitteln den Status der Tasten:
6+
7+- Caps Lock oder Shift Lock oder Umschaltsperre oder Feststelltaste
8+- Insert oder Einfügen-Taste
9+- Num Lock oder Num-Taste oder Num-Lock-Taste
10+- Scroll Lock oder Rollen-Taste oder Scroll-Lock-Taste
11+
12+Beispiel:
13+
14+``` pascal
15+uses
16+ Windows, ...;
17+
18+ ...
19+
20+function funLowOrderBitSet(intWert: integer): boolean; inline;
21+begin
22+ Result := (intWert and 1 > 0);
23+end;
24+
25+// ermittelt, ob die Caps-Lock-Taste aktiv ist
26+function funCapsLock: boolean;
27+begin
28+ Result := funLowOrderBitSet(GetKeyState(VK_CAPITAL));
29+end;
30+
31+// ermittelt, ob die Einfügen-Taste aktiv ist
32+function funInsertOn: boolean;
33+begin
34+ Result := funLowOrderBitSet(GetKeyState(VK_INSERT));
35+end;
36+
37+// ermittelt, ob die Num-Lock-Taste aktiv ist
38+function funNumLock: boolean;
39+begin
40+ Result := funLowOrderBitSet(GetKeyState(VK_NUMLOCK));
41+end;
42+
43+// ermittelt, ob die Scoll-Lock-Taste aktiv ist
44+function funScrollLock: boolean;
45+begin
46+ Result := funLowOrderBitSet(GetKeyState(VK_SCROLL));
47+end;
48+
49+ ...
50+
51+```
52+
53+---
54+*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](/wiki-contact).*

Back to history