CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Mouse position

  1. #1
    Join Date
    Dec 2000
    Location
    Japan
    Posts
    9

    Mouse position

    PLease help!!!
    Does anyone khow to get the mouse position (X,Y)?

    Thanks in ADv


    ///////////////////////////////
    MACMAK
    ///////////////////////////////

  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: Mouse position

    check the mouse move event

    Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    X & Y is the position

    HTH

    cksiow
    http://vblib.virtualave.net - share our codes


  3. #3
    Join Date
    Dec 2000
    Location
    Japan
    Posts
    9

    Re: Mouse position

    thank you!
    but are ther any code to get ONLY a mouse position?




    ///////////////////////////////
    MACMAK
    ///////////////////////////////

  4. #4
    Join Date
    Apr 2000
    Posts
    737

    Re: Mouse position

    check the GetMouseMovePointsEx API, it might help.


  5. #5
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Mouse position

    Try the GetCursorPos() API function.


  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Mouse position

    The mouse event is activated only on form.
    The Api shree suggested will get mouse everywhere on screen.
    If you need an example, add a Bas module to your project
    add this code:

    module bas code:
    Option Explicit

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

    Public Type PointAPI
    X As Long
    Y As Long
    End Type

    form code:
    'on top:
    option explicit
    Dim Coords As PointAPI

    'where you need to get x and y:
    GetCursorPos Coords 'getting position
    Me.Caption = "Current Mouse Position: " & Coords.X & "," & Coords.Y 'showing

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

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

Featured