Hi!
Put the following in a module:
Public Type POINTAPI
x As Long
y As Long
End Type
Public Declare Function GetCursorPos& Lib "user32" (lpPoint As POINTAPI)
Then add a timer control to the form and in the Timer event you can add the
following or something similar:
Dim CurPoint As POINTAPI
Dim Dummy&
Dummy& = GetCursorPos(CurPoint)
if Dummy& = 0 then
'error handling
else
Text1.text = str(CurPoint.x) & " " & str(CurPoint.y) 'textbox named
text1
end if
Having that said there is a much easier way, simply add code to the forms
MouseMove Event, it provides you with the x and y positions...
Quote:
> Hi all
> Hope someone can help i am quite new to vb and i dont understand
>where to use type definitions
>this is what i am trying to do
>i want to display the cursor position cordinates
>so i declare this : Declare Function GetCursorPos Lib "user32.dll" (ByVal
>lpPoint As POINTAPI) As Long
>in my general declarations of my form.
>but where do i use type to declare the POINTAPI type i use this
>Type POINTAPI
> x As Long
> y As Long
>End Type
>But where in the code should it go? on the form in a bas module or what??
> Thanks Andy