Visual Basic (2010) sendkeys non funziona

mishtu3uait

Utente Attivo
32
0
Lo script è il seguente (oppure qua è con l'highlight http://pastebin.com/5uD9aEHK):

Codice:
Public Class Form1
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If GetAsyncKeyState(Keys.F1) Then
            SendKeys.Send(TextBox1.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F2) Then
            SendKeys.Send(TextBox2.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F3) Then
            SendKeys.Send(TextBox3.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F4) Then
            SendKeys.Send(TextBox4.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F5) Then
            SendKeys.Send(TextBox5.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F6) Then
            SendKeys.Send(TextBox6.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F7) Then
            SendKeys.Send(TextBox7.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F8) Then
            SendKeys.Send(TextBox8.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F9) Then
            SendKeys.Send(TextBox9.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F10) Then
            SendKeys.Send(TextBox10.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F11) Then
            SendKeys.Send(TextBox11.Text)
            SendKeys.Send("{ENTER}")
        ElseIf GetAsyncKeyState(Keys.F12) Then
            SendKeys.Send(TextBox12.Text)
            SendKeys.Send("{ENTER}")
        End If
    End Sub
End Class
Il mio problema è che quando premo un tasto (F1,F2,ecc..) non mi scrive il testo contenuto nella textbox. Come mai? Cosa ho sbagliato? Ho provato anche "Form1_Load", "Form1_KeyPress", "Form1_KeyDown", "Form1_KeyUp"... :boh:
 

Entra

oppure Accedi utilizzando
Discord Ufficiale Entra ora!