Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Program running on background

$
0
0
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:
 
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

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>