Using a VB.net program to click the mouse on certain coordinates

I am trying to use mouse commands like...

Mouse.Move.SetMousePosition(150,120)
Mouse.Click.LeftDown()
Mouse.Click.LeftUp()

In a VB.NET program, but it does not recognize Mouse.Click or Mouse.Move.  Do I need to add a reference?  I tried adding "Imports Mouse", but that did not work.
BrianAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cmdolcetCommented:
Do you have any code you can share?
0
Éric MoreauSenior .Net ConsultantCommented:
What are you trying to do exactly? You probably cannot control the mouse as you want.
0
BrianAuthor Commented:
All I want to do is move the mouse to a certain coordinate on the screen and click the left mouse button.  I'm trying to use this code I found on YouTube...
https://www.youtube.com/watch?v=eHZd0MvwmnQ
0
BrianAuthor Commented:
I think this is what I need...
Public Class Form1
    Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long)
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Me.Cursor = New Cursor(Cursor.Current.Handle)
        Cursor.Position = New Point(150, 150)
        mouse_event(&H2)
        mouse_event(&H4)
        Cursor.Position = New Point(200, 200)
        mouse_event(&H2)
        mouse_event(&H4)
    End Sub
End Class

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BrianAuthor Commented:
Tested the code and it works.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.