Foro de elhacker.net

Programación => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: avmiitxe en 26 Abril 2011, 14:01 pm



Título: [VB] Necesito ayuda con Hoykeys
Publicado por: avmiitxe en 26 Abril 2011, 14:01 pm
Hola, estoy haciendo un programa en Visual Basic 2008, que al darle a la tecla F2 por ejemplo se activa el Timer1, aquí os voy a dejar un poco de código para explicar mejor:

Timer1:
Código:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
      
        CheckBox1.checked = true

    End Sub

Timer2:
Código:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim hotkey As Boolean

        If TextBox1.Text = "F1" Then
            hotkey = GetAsyncKeyState(Keys.F1)
        End If

        If TextBox1.Text = "F2" Then
            hotkey = GetAsyncKeyState(Keys.F2)
        End If

        If hotkey = True Then
            Timer1.Start()
        End If


    End Sub

Quiero hacer que el Timer1 se active al darle A LA TECLA QUE HAY ESCRITA EN EL TEXTBOX1, y quiero hacer que se puedan poner todas las teclas del teclado, pero sería una matada poner todas las teclas con
Código:
If TextBox1.Text = "F3" Then
            hotkey = GetAsyncKeyState(Keys.F3)
        End If

Y así seguir F4, F5, F6...

¿Hay alguna manera de que la tecla que introduzca en el Textbox1 sea la hotkey sin tener que escribir todas?

Por ejemplo:
Código:
            hotkey = GetAsyncKeyState(Textbox1.text)
        End If

pero eso no funciona, ¿es posible hacer lo que quiero?

gracias de antebrazo


Título: Re: [VB] Necesito ayuda con Hoykeys
Publicado por: CAR3S? en 26 Abril 2011, 17:29 pm
esto no es .net?


Título: Re: [VB] Necesito ayuda con Hoykeys
Publicado por: 79137913 en 26 Abril 2011, 17:39 pm
HOLA!!!

Esto va en Net (http://foro.elhacker.net/net-b62.0/)

Reportado

GRACIAS POR LEER!!!