GetCursorPos with VB.NET. How to use it?

  • Thread starter Thread starter Willian F. Lopes
  • Start date Start date
W

Willian F. Lopes

Hi!

I'm trying to use the GetCursorPos function with VB.NET. I did this:

1) A create Module. In this module I have this code:

Public Structure POINTAPI
Public x As Long
Public y As Long
End Structure

Public Declare Function GetCursorPos Lib "user32" (ByVal lpPoint As
POINTAPI) As Long

2) In my main form I put a timer and it tick event I have this code:

Dim p As POINTAPI
Dim l As Long

' Get pointer position.
l = GetCursorPos(p)

' Display information.
Me.Text = CStr(p.x) + ", " + CStr(p.y)

My problem is that my mouse coordinates are always 0 ("0,0"). Where is my
error?

Thanks,

Willian
 
William,

Will you please be so kind not to multipost, I see a long discussion about
this in an other newsgroup.

Cor
 
Back
Top