Results 1 to 4 of 4

Thread: GetCursorPos Api

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517

    Post

    Hello All,

    I need a little hand in helping me to build something using a GetCursorPos Api. What Its gonna do is when the mouse clicks it will Put the cursor in a variable. But when I try to do this it screwed up, and it wont allow me to store the Variable info.

    What I tried was this...

    Dim IntCurPosNEW as long
    IntCurPosNEW = GetCursorPos point

    But when It did that it came up with a syntax error..

    Anyhelp???

    Thankyou much,

    Evan

  2. #2
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    Code:
    Type POINTAPI
         x As long
         y As Long
    End Type
    
    Private Sub Command1_Click()
    Dim z As POINTAPI
    Call GetCursorPos(z)
    MsgBox "X = " & z.x & vbCrLf & "Y = " & z.y
    End Sub
    That code is untested.

    ------------------
    Tom Young, 14 Year Old
    [email protected]
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    take a look at This great site for VB usage examples and explanations.

    ------------------
    Marty

  4. #4
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Galway, Ireland
    Posts
    316

    Post

    GetCursorPos Function
    Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINT_TYPE) As Long

    GetCursorPos reads the current position of the mouse cursor. The x and y coordinates of the cursor (relative to the screen) are put into the variable passed as lpPoint. The function returns 0 if an error occured or 1 if it is successful.

    lpPoint
    Receives the x and y coordinates of the mouse cursor.
    Example:

    ' Display the coordinates of the mouse cursor
    Dim coord As POINT_TYPE ' receives coordinates of cursor
    Dim retval As Long ' return value

    retval = GetCursorPos(coord) ' read cursor location
    Debug.Print "The mouse is at:"; coord.x; coord.y

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