Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Virtual Mouse - Form1.vb

Form1.vb

Caricato da: Progman-92
Scarica il programma completo

  1. Public Class Form1
  2.  
  3.     Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
  4.     Const KEYEVENTF_EXTENDEDKEY = &H1
  5.     Const KEYEVENTF_KEYUP = &H2
  6.     Declare Auto Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Int32, ByVal dx As Int32, ByVal dy As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As IntPtr)
  7.     Dim pixel As Integer = 5
  8.  
  9.  
  10.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  11.         If GetAsyncKeyState(Keys.Down) And My.Computer.Keyboard.AltKeyDown = True Then
  12.             Dim x As Integer = Cursor.Position.X
  13.             Dim y As Integer = Cursor.Position.Y
  14.             Cursor.Position = New Point(x, y + pixel)
  15.         End If
  16.         If GetAsyncKeyState(Keys.Up) And My.Computer.Keyboard.AltKeyDown = True Then
  17.             Dim x As Integer = Cursor.Position.X
  18.             Dim y As Integer = Cursor.Position.Y
  19.             Cursor.Position = New Point(x, y - pixel)
  20.         End If
  21.         If GetAsyncKeyState(Keys.Left) And My.Computer.Keyboard.AltKeyDown = True Then
  22.             Dim x As Integer = Cursor.Position.X
  23.             Dim y As Integer = Cursor.Position.Y
  24.             Cursor.Position = New Point(x - pixel, y)
  25.         End If
  26.         If GetAsyncKeyState(Keys.Right) And My.Computer.Keyboard.AltKeyDown = True Then
  27.             Dim x As Integer = Cursor.Position.X
  28.             Dim y As Integer = Cursor.Position.Y
  29.             Cursor.Position = New Point(x + pixel, y)
  30.         End If
  31.         If GetAsyncKeyState(Keys.Insert) And My.Computer.Keyboard.AltKeyDown = True Then
  32.             mouse_event(2, 0, 0, 0, 0)
  33.             mouse_event(4, 0, 0, 0, 0)
  34.         End If
  35.         If GetAsyncKeyState(Keys.Enter) And My.Computer.Keyboard.AltKeyDown = True Then
  36.             mouse_event(8, 0, 0, 0, 0)
  37.             mouse_event(16, 0, 0, 0, 0)
  38.         End If
  39.     End Sub
  40.  
  41.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  42.         Label1.Text = "Risoluzione schermo = " & Screen.PrimaryScreen.WorkingArea.Width & " X " & Screen.PrimaryScreen.WorkingArea.Height
  43.         Timer1.Start()
  44.     End Sub
  45.  
  46.     Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
  47.         If NumericUpDown1.Value > 50 Then
  48.             NumericUpDown1.Value = 1
  49.         Else
  50.             pixel = NumericUpDown1.Value
  51.         End If
  52.     End Sub
  53.  
  54.     Private Sub NotifyIcon1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Click
  55.         If Me.Opacity = 0 Then
  56.             Me.Opacity = 100
  57.         Else
  58.             Me.Opacity = 0
  59.         End If
  60.       End Sub
  61.  
  62.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  63.         AboutBox1.ShowDialog()
  64.     End Sub
  65. End Class