Results 1 to 4 of 4

Thread: Simulate Mouse Click

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    10

    Simulate Mouse Click

    I would like to simulate mouse clicks at fix coordinates without using api calls. Any1 any ideas?

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    well, if you wanted to simulate it, you can do it this way.

    You can simulate which mouse button, how many times the button was clicked, the x coodrinate, and the y coordinate, and the last parameter is the wheel rotation (which you should just leave at 0).

    VB Code:
    1. Form1_MouseDown(Nothing, New MouseEventArgs(MouseButtons.Left, 1, 150, 150, 0))

  3. #3
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Otherwise, this is a more technical way:
    VB Code:
    1. Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
    2.         MessageBox.Show("Mouse clicked")
    3.  
    4.  
    5.     End Sub
    6.  
    7.     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    8.         Dim f As New Timer
    9.         f.Interval = 5000
    10.         f.Start()
    11.         AddHandler f.Tick, AddressOf Timer_Click
    12.  
    13.     End Sub
    14.  
    15.     Private Sub Timer_Click(ByVal sender As Object, ByVal e As EventArgs)
    16.         Dim f As MouseEventArgs = New MouseEventArgs(MouseButtons.Left, 1, 40, 40, 0)
    17.         Me.InvokeOnClick(Me, f)
    18.     End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    10
    thank you very much. but i should have been more specific. I want to do it to another window or the currently focused window. but that particular window has its process hidden. any idea? thanks in advance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width