1
Answer

move mouse cursor to specific location of external application like notepad

Photo of Robert Pellegrin

Robert Pellegrin

14y
6.7k
1

I am trying to fix the code below to move the mouse cursor to a specific location within a different window/application.  The code below will move the mouse to the specified coordinates, but not of the notepad window.  Can anyone tweak the code below to move the mouse to point 10,10 on the Notepad window?  I want to point to specific coordinates relative to the active window, not the desktop.
 
 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim NewMousePosition As Point

AppActivate(
"Notepad")
NewMousePosition =
New Drawing.Point(10, 10)
Windows.Forms.
Cursor.Position = PointToScreen(NewMousePosition)

End Sub
 

Answers (1)

0
Photo of kovan
NA 636 0 20y
try looping through this.Controls and use a if statement to filter out what type of control you want. i assume u are adding the controls to the parent as u create them