move mouse cursor to specific location of external application like notepad

Feb 3 2011 8:47 AM

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)