Ok i have been working on this a while and still cant get this to work:

I have it set so that when i hit the button it gets the x and y coords for me and places them into the feilds for me:

This part i have working
But I need to be able to click the button and then move the mouse into windows and be able to target any where I want and have it put the x and y coords into the feilds for me, as it is right now when I click the button it automaticly puts the coords into the feild but only from the point where I click it on the button itself

(create a form and have one button in it and two text boxes and using the code below.)

PLEASE HELP ME!!!!!!!!!!!!


here is the code:


private Sub record_Click()
' Create instance of POINTAPI
Dim CursorLocal as POINTAPI

' Locate the cursor using the API
GetCursorPos CursorLocal

' Displays the X Y coordinates for the user.
Text1 = CursorLocal.x
Text2 = CursorLocal.x
End Sub




Here is the module:

option Explicit

Declare Function GetCursorPos Lib "user32" (lpPoint as POINTAPI) as Long

' point type returned by GetCursorPos API
public Type POINTAPI
x as Long
y as Long
End Type



HEEEEEEEEEEEELP

Thank you in advance.