Results 1 to 5 of 5

Thread: Screen Coordinates [Solved]

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    27

    Resolved Screen Coordinates [Solved]

    Is there code in VB to be able to find screen cootdinates? Or does anyone know a way to find them.

    I want VB to place the mouse at a certain point on the screen but have no idea where the coords are or how to find them.


    Thanks!
    Last edited by Malkavian; May 26th, 2005 at 04:04 PM. Reason: my horrible spelling/grammer.

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Screen Coordinates

    Quote Originally Posted by Malkavian
    Is there code in VB to be able to find screen cootdinates? Or does anyone know a way to find them.

    I want VB to place the mouse at a certain point on the screen but have no idea where the coords are or how to find them.


    Thanks!

    I'm not quite shure what you want, the GetCursorPos API function can get the position of the cursor on the screen.

    Can you define what it is you want to do more clearily?

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  3. #3
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Screen Coordinates

    If you are talking bout just your form, be sure your Scalemode = 3 - Pixels

  4. #4
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    537

    Re: Screen Coordinates

    to get the cursor position on the screen use this

    VB Code:
    1. Option Explicit
    2. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    3.  
    4. Private Type POINTAPI
    5. x As Long
    6. y As Long
    7. End Type
    8.  
    9. Private Sub Timer1_Timer()
    10. Dim POS As Long
    11. Dim Cursor As POINTAPI
    12. POS = GetCursorPos(Cursor)
    13. Label1.Caption = "X = " & Cursor.x & "    " & "Y = " & Cursor.y
    14. End Sub

    -Sir Loin

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    27

    Re: Screen Coordinates

    Got it thanks all.

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