Results 1 to 3 of 3

Thread: Pointapi ?[Resolved]

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Pointapi ?[Resolved]

    Why this won't work in .NET but work in VB6 with little difference(POINTAPI as Type not Structure)?
    VB Code:
    1. Private Structure POINTAPI
    2.         Dim X As Long
    3.         Dim Y As Long
    4.     End Structure
    5.     Dim mousepos As POINTAPI
    6.  
    7.     Private Declare Function GetCursorPos Lib "user32" (ByVal lpPoint As POINTAPI) As Long

    Usage :

    VB Code:
    1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    2.         GetCursorPos(mousepos)   ' Get Co-ordinets
    3.         Label1.Text = "x: " & mousepos.X  ' Get x co-ordinates
    4.         Label2.Text = "y: " & mousepos.Y ' Get y co-ordinates
    5.     End Sub
    Last edited by Pirate; May 12th, 2003 at 11:05 AM.

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    That doesnt work for me either, I tried Int32 instead of Long and still it didnt work, but I dont know why you want to ue that API when you can simply get the position of mouse on screen by:
    Me.Cursor.Position.X and Me.Cursor.Position.Y
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Never thought of that . Thanks for making me look at it !

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