Cómo crear un registrador de teclas para juegos en un lenguaje sencillo
Si se presiona, significa que se presiona la tecla anterior
El código fuente agregado por un nuevo módulo es el siguiente
Función de declaración pública GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState " (ByVal vKey As Long) Como entero
Sub Key_Eye()
Si GetAsyncKeyState(vbKeyCancel) Entonces
Form1.Text1.Text = Form1.Text1 .Text = Form1.Text1 .Text = Form1.Text1.Text = Form1.Text1.Text = Form1.Text1.Text = Form1.Text1.TextText1.Text = Form1.Text1.Text & "Tecla CANCELAR"
Finalizar si
p>Finalizar si
Si GetAsyncKeyState(vbKeyBack) Entonces
Form1.Text y "CLEAR key"
Fin si
Si GetAsyncKeyState( vbKeyReturn) Entonces
Form1.Text1.Text = Form1.Text1.Text1.Text = Form1.Text1.Text & "tecla de FLECHA IZQUIERDA"
Finalizar si p>
Si GetAsyncKeyState(vbKeyUp) Entonces
Form1.Text1.Text y "tecla IMPRIMIR PANTALLA"
Finalizar si
Si GetAsyncKeyState( vbKeyExecute) Entonces
Form1.Text1.Text = Form1.Text1.Text = Form1.Text1.Text & "INSERT key"
Finalizar si
Si GetAsyncKeyState(vbKeyDelete ) Entonces
Form1.Text1.Text y "tecla AYUDA"
Fin si
Si GetAsyncKeyState( vbKeyNumlock) Entonces
Form1.Text1.Text = Form1.Text1.Text1.Text = Form1.Text1.Text & "b"
Finalizar si
Si GetAsyncKeyState(67) Luego
Form1.Text & "d"
Finalizar si
Si GetAsyncKeyState( 69) Entonces
Form1. Text1.Text = Form1.Text1. Text & "e"
Finalizar si
Si GetAsyncKeyState(70) Entonces
Form1.Text1.Text = Form1. Text1.Text & "E"
Finalizar si
Si GetAsyncKeyState(71) Entonces
Form1.Text1.Text = Form1.Text1.Text &
"F"