Atlanta Custom Software Development 

   Search        Code/Page

User Login



Forgot the Password?
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
» Regular Expr Tester
» Free Tools

MoveMouseCursor - Move the mouse to given coordinates

Total Hit ( 2498)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article



Click here to copy the following block
Private Type POINTAPI
  X As Long
  Y As Long
End Type

Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, _
  ByVal Y As Long) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hWnd As Long, _
  lpPoint As POINTAPI) As Long

' Mouse the mouse cursor.
' If a window handle is passed, the coordinates
' are considered to be relative to that window's client area,
' otherwise they are considered to be relative to the screen.
' In all cases, coordinates are in pixels

Sub MoveMouseCursor(ByVal X As Long, ByVal Y As Long, _
  Optional ByVal hWnd As Long)
  If hWnd = 0 Then
    SetCursorPos X, Y
    Dim lpPoint As POINTAPI
    lpPoint.X = X
    lpPoint.Y = Y
    ClientToScreen hWnd, lpPoint
    SetCursorPos lpPoint.X, lpPoint.Y
  End If
End Sub

Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with, SQL Server and other MS technologies. He is, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )

Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.