Ver Mensaje Individual
  #5  
Antiguo 11-08-2005
Avatar de jmariano
jmariano jmariano is offline
Miembro
 
Registrado: jul 2005
Posts: 376
Reputación: 19
jmariano Va por buen camino
Saludos!

Es que GetKeyState() devuelve la información, mas bien, a base de bits. Pero si al resultado de esta función le sumas simplemente 127, verás que te devolverá 0, cuando el NumLock está activo, y -1, cuando no lo está.

Código Delphi [-]
procedure TForm.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_NUMLOCK then
    case (GetKeyState(VK_NUMLOCK) + 127) of
      0: ShowMessage('Activo'); // Permite usar el teclado numérico
     -1: ShowMessage('Inactivo'); // Sólo funciona las teclas cursoras
    end;
end;
Responder Con Cita