Riferimento: Hotkeys
dove devo inserire il primo codice?
--------------- AGGIUNTA AL POST ---------------
ho inserito così:
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Const mouseclickup = 4
Private Const mouseclickdown = 2
End sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Windows.Forms.Cursor.Position = New System.Drawing.Point(Windows.Forms.Cursor.Position)
mouse_event(mouseclickdown, 0, 0, 0, 0)
mouse_event(mouseclickup, 0, 0, 0, 0)
Timer1.Enabled = True
Timer1.Interval = TextBox1.Text
Dim hotkey As Boolean
hotkey = GetAsyncKeyState(Keys.F2)
If hotkey = True Then Timer1.Start()
End Sub
End Class
Ho messo bene ?Perchè non va!