Jump to content

Mouse Co-Ords


Recommended Posts

#include <GUIConstants.au3>
GUICreate("Mouse Coords", 200, 200) ;This Creates the GUI Window
$xpos = GUICtrlCreateLabel("Ordinate X: ", 10, 10, 200) ;This creates a label.
$ypos = GUICtrlCreateLabel("Ordinate Y: ", 10, 30, 200) ;This creates another label.
GUISetState(@SW_SHOW) ;We need to do this, so the GUI will show up.
While 1 ;While loop.
    $Mpos = MouseGetPos() ;We get the position of the mouse.
    GUICtrlSetData($xpos, "Ordinate X: " & $Mpos[0]) ;Changes the label to the current mouse position.
    GUICtrlSetData($ypos, "Ordinate Y: " & $Mpos[1]) ;Changes the label to the current mouse position.
    $msg = GUIGetMsg() ;Get whatever has been pressed.
        Select ;Begin Case Statement
            Case $msg = $GUI_EVENT_CLOSE ;If the exit button is pressed then
                Exit ;exit the program
        EndSelect ;end the case statement.
WEnd ;continue the loop

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...