Prueba con estas funciones, pero que pasa si el usuario desconecta la tecla.
Yo más bien interceptaría las entradas del teclado y las convertiría a mayúsculas.
Comment savoir si la touche Caps Lock est active
function IsCapsLockOn : boolean;
begin
Result := 0 <> (GetKeyState(VK_CAPITAL) and $01);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
keys: TKeyboardState;
begin
{1 = on, 0 = off}
GetKeyboardState( keys );
keys[VK_NUMLOCK] := 1; {Num Lock}
keys[VK_CAPITAL] := 1; {Caps Lock}
keys[VK_SCROLL] := 1; {Scroll Lock}
SetKeyboardState( keys );
end;
Un Saludo.
|