Página 1 de 1

Simulando uma HotKey

Enviado: 18 Nov 2019 13:43
por asimoes
Simulando uma hotkey ALT 423

Código: Selecionar todos

STATIC FUNCTION VerTecla( oDlg, lAcessoEspecial ) 
LOCAL nKey, cKey, nSec

   oDlg:oTimerTecla:End()
      
   IF hwg_LastKey() = 18 //alt
      nKey := 0
      cKey := ""
      nSec := Seconds()      
      DO WHILE nKey != 27 
         nKey := InkeyGui(1)   
         IF nKey != 18 .AND. nKey >= 96 .AND. nKey <= 105 // faixa 0..9    
            cKey += Hb_NtoS( nKey )
         ENDIF
         IF cKey == "1009899" //Senha 423 para desabilitar o derruba//
            lAcessoEspecial := .T.
            nKey := 27
         ELSE
            IF Len( cKey ) > 7
               cKey := ""
            ENDIF
         ENDIF
         IF ( Seconds() - nSec ) > 10
            EXIT
         ENDIF   
         hwg_DoEvents()
      ENDDO
   ENDIF
   
   SET TIMER oTimerTecla of oDlg VALUE 100 ACTION {|| VerTecla( oDlg, @lAcessoEspecial )  }
   
RETURN Nil