Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 12-12-2004
Gustavo Gowdak Gustavo Gowdak is offline
Miembro
 
Registrado: jun 2004
Posts: 49
Poder: 0
Gustavo Gowdak Va por buen camino
Post Activacion de Teclas

Como saber si estan activadas las teclas MAY, BLOQ, NUM, y luego mostrarlas si estan en el StatusBar....
Responder Con Cita
  #2  
Antiguo 13-12-2004
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Poder: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
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
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 22:12:20.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi