NumLock, CapsLock and ScrollLock status

function NumLockOn:boolean; //Checks the status of NumLock
var KeyState:TKeyboardState;
begin
     GetKeyboardState(KeyState);
     Result:=(KeyState[VK_NUMLOCK] and 1) = 1;
end;

function CapsLockOn:boolean; //Checks the status of CapsLock
var KeyState:TKeyboardState;
begin
     GetKeyboardState(KeyState);
     Result:=(KeyState[VK_CAPITAL] and 1) = 1;
end;

function ScrollLockOn:boolean; //Checks the status of ScrollLock
var KeyState:TKeyboardState;
begin
     GetKeyboardState(KeyState);
     Result:=(KeyState[VK_SCROLL] and 1) = 1;
end;

 

16 Aug 2001

Copyright 2001-2005 (C) ykwong.com All rights reserved.