Usa la función GetKeyState:
Código Delphi
[-]
var
KeyState: SmallInt;
begin
KeyState := GetKeyState(VK_CAPITAL);
if KeyState and $1 <> 0
then ShowMessage('MAY está encendido')
else ShowMessage('MAY está apagado')
KeyState := GetKeyState(VK_SCROLL);
if KeyState and $1 <> 0
then ShowMessage('SCROLL está encendido')
else ShowMessage('SCROLL está apagado')
KeyState := GetKeyState(VK_NUMLOCK);
if KeyState and $1 <> 0
then ShowMessage('NUMLOCK está encendido')
else ShowMessage('NUMLOCK está apagado')
end;
También puedes usar GetKeyboardState para obtener todas al mismo tiempo:
Código Delphi
[-]
var
KeyboardState: TKeyboardState;
begin
GetKeyboardState(KeyboardState);
if KeyboardState[VK_CAPITAL] and $1 <> 0
then ShowMessage('MAY está encendido')
else ShowMessage('MAY está apagado')
if KeyboardState[VK_SCROLL] and $1 <> 0
then ShowMessage('SCROLL está encendido')
else ShowMessage('SCROLL está apagado')
if KeyboardState[VK_NUMLOCK] and $1 <> 0
then ShowMessage('NUMLOCK está encendido')
else ShowMessage('NUMLOCK está apagado')
end;
Quizá lo más conveniente sea incluir alguno de los dos códigos en el evento OnTimer de un Timer para actualizar en automático tu StatusBar.
// Saludos