Article View: alt.msdos.programmer
Article #650Re: Toggling NumLock
From: Johannes Beekhuizen
Date: Mon, 28 Sep 1992 09:44
Date: Mon, 28 Sep 1992 09:44
115 lines
3327 bytes
3327 bytes
TO: m_rheau@pavo.concordia.ca
Hallo RHEAUME,
Op maandag 28 september 1992, schreef RHEAUME, MICHEL aan All:
RM> Organization: Concordia University
RM> @Message-ID: <27SEP199221155761@pavo.concordia.ca>
RM> As simple as it sounds, I can't think of a way to
RM> toggle the NumLock key (through software of course!).
I found a unit for it in another the other day. All credits to its author!
Van : Dirk-Jan Uittenbogaard 2:280/463 wo 23 sep 92 14:48
Ondw. : Aansturing van CAPS-LOCK en SCROLL-LOCK
BS> Unit KEYLOCKS;
USES Dos; {he forgot that line}
BS> interface
BS> Var
BS> Key_Status_Bits: Word absolute $0040:$0017;
BS> function Alt_Pressed: Boolean;
BS> function Ctrl_Pressed: Boolean;
BS> function LeftShift_Pressed: Boolean;
BS> function RightShift_Pressed: Boolean;
BS> function CapsOn: Boolean;
BS> function NumOn: Boolean;
BS> function ScrollOn: Boolean;
BS> procedure Set_Caps(On: Boolean);
BS> procedure Set_Num(On: Boolean);
BS> procedure Set_Scroll(On: Boolean);
BS> procedure ResetKeyboard;
BS> { Aanroepen *na* elke Set_... procedure om de lichtjes daadwerkelijk te
BS> laten veranderen op het keyboard.
BS> }
BS> implementation
BS> function Alt_Pressed: Boolean;
BS> begin
BS> Alt_Pressed := (Key_Status_Bits AND $08) <> 0
BS> end {Alt_Pressed};
BS> function Ctrl_Pressed: Boolean;
BS> begin
BS> Ctrl_Pressed := (Key_Status_Bits AND $04) <> 0
BS> end {Ctrl_Pressed};
BS> function LeftShift_Pressed: Boolean;
BS> begin
BS> LeftShift_Pressed := (Key_Status_Bits AND $02) <> 0
BS> end {LeftShift_Pressed};
BS> function RightShift_Pressed: Boolean;
BS> begin
BS> RightShift_Pressed := (Key_Status_Bits AND $01) <> 0
BS> end {RightShift_Pressed};
BS> function CapsOn: Boolean;
BS> begin
BS> CapsOn := (Key_Status_Bits AND $40) <> 0
BS> end {CapsOn};
BS> function NumOn: Boolean;
BS> begin
BS> NumOn := (Key_Status_Bits AND $20) <> 0
BS> end {NumOn};
BS> function ScrollOn: Boolean;
BS> begin
BS> ScrollOn := (Key_Status_Bits AND $10) <> 0
BS> end {ScrollOn};
BS> procedure Set_Caps(On: Boolean);
BS> begin
BS> If On then Key_Status_Bits := (Key_Status_Bits OR $40)
BS> else Key_Status_Bits := (Key_Status_Bits AND $BF)
BS> end {Set_Caps};
BS> procedure Set_Num(On: Boolean);
BS> begin
BS> If On then Key_Status_Bits := (Key_Status_Bits OR $20)
BS> else Key_Status_Bits := (Key_Status_Bits AND $DF)
BS> end {Set_Num};
BS> procedure Set_Scroll(On: Boolean);
BS> begin
BS> If On then Key_Status_Bits := (Key_Status_Bits OR $10)
BS> else Key_Status_Bits := (Key_Status_Bits AND $EF)
BS> end {Set_Scroll};
BS> procedure ResetKeyboard;
BS> var Regs : Registers;
BS> begin
BS> Regs.AH := 1;
BS> Intr($16, Regs)
BS> end;
BS> end.
Groetjes,
Hans.
Technical Details
Message-ID:
<717722425.F00001@monly.wlink.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!wtrlnd!monly!news-daemonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!wtrlnd!monly!news-daemon From: Johannes.Beekhuizen@p5.f112.n100.z60.wlink.nl (Johannes Beekhuizen) Newsgroups: alt.msdos.programmer Subject: Re: Toggling NumLock Message-ID: <717722425.F00001@monly.wlink.nl> Date: Mon, 28 Sep 1992 08:44:48 -0100 Sender: news-daemon@monly.wlink.nl Lines: 116