Results 1 to 3 of 3

Thread: GetCursorPos

  1. #1

    Thread Starter
    Addicted Member DarkMoose's Avatar
    Join Date
    Jul 2000
    Location
    in a box
    Posts
    185
    Hihi! I'm working on my awesome map editor for my RPG And I'm using GetCursorPos to select the tile that I want to change/edit walkability on. All is well, except I need to know one thing: How do I make the GetCursorPos API have the 0,0 coordinate start at the top left of the picturebox, rather than the top left of the screen?
    To understand recursion, one must first understand the concept of recursion.

  2. #2
    New Member mwc's Avatar
    Join Date
    Feb 2001
    Location
    Canada/Poland
    Posts
    3
    ......very easy
    add:
    -picture1
    -timer1
    to the project



    Private Type POINTAPI
    X As Long
    Y As Long
    End Type

    Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long


    Private Sub Timer1_Timer()
    Dim pt As POINTAPI

    GetCursorPos pt

    ' Translate into window coordinates.
    ScreenToClient Picture1.hwnd, pt

    Debug.Print pt.X, pt.Y

    End Sub

  3. #3

    Thread Starter
    Addicted Member DarkMoose's Avatar
    Join Date
    Jul 2000
    Location
    in a box
    Posts
    185
    Thanks a lot
    To understand recursion, one must first understand the concept of recursion.

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