Hello, i am making a program to allow moving cursor using keyboard
however, it only allows the user to move the cursor when its on the program interface. Is there any way for the program to run in the background so that the user can use it on desktop?
Code i use:
and for the KeyUp
My second question is: is it possible not to have the KeyUp code?
Any help is appreciated
Thanks
however, it only allows the user to move the cursor when its on the program interface. Is there any way for the program to run in the background so that the user can use it on desktop?
Code i use:
Private Sub KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyValue = Keys.Left Then
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X - 1, Cursor.Position.Y - 0)
Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End If
If e.KeyValue = Keys.Right Then
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X + 1, Cursor.Position.Y - 0)
Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End If
If e.KeyValue = Keys.Up Then
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X - 0, Cursor.Position.Y - 1)
Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End If
If e.KeyValue = Keys.Down Then
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X - 0, Cursor.Position.Y + 1)
Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End If
End Sub
and for the KeyUp
Private Sub KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
If e.KeyValue = Keys.Left Then
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X - 0, Cursor.Position.Y - 0)
Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End If
If e.KeyValue = Keys.Right Then
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X + 0, Cursor.Position.Y - 0)
Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End If
If e.KeyValue = Keys.Up Then
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X + 0, Cursor.Position.Y - 0)
Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End If
If e.KeyValue = Keys.Down Then
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X - 0, Cursor.Position.Y - 0)
Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End If
End Sub
My second question is: is it possible not to have the KeyUp code?
Any help is appreciated
Thanks