Jump to content

Detect mouse movement on picture?


walle
 Share

Recommended Posts

I would like to detect mouse movements on picture. So if I point the mouse on a picture

the script would recognize it. Any idea what I should look for?

Maybe GUIGetCursorInfo would get what you want. It returns an array and the 5th element is the ID of the control the cursor is over.

Here is an example from the help but modified.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $x, $y, $n, $a

Example()

Func Example()
    Local $msg


    GUICreate("Press Esc to Get Pos", 400, 400)
    $n = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg", 50, 50, 200, 50)
    $x = GUICtrlCreateLabel("0", 10, 10, 50)
    $y = GUICtrlCreateLabel("Pic id = " & $n, 10, 30, 50)
    
    GUISetState()

; Run the GUI until the dialog is closed
    Do
        GetPos()
        $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE
EndFunc  ;==>Example

Func GetPos()
    Local $b

    $b = GUIGetCursorInfo()
    if $b[4] <> $a then
        GUICtrlSetData($x, $b[4])
        $a = $b[4]
    EndIf

EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...