Jump to content

Recommended Posts

Posted

i want that msgbox will appear when the mouse cursor is on a label.

i tried to do it with getting the mouse coords but i can't see if it's matching the label coords coz the gui window can be moved and the label coords will change, so how do i do that?

Posted

You can get label coord with the ControlGetPos (get control ID or classname with the Au3Info) and compare it coordinates with the mouse coords. Like this:

Opt("MouseCoordMode", 2)
Run("notepad.exe")
Sleep(300)
While 1
    Sleep(10)
    $cpos = ControlGetPos("Untitled - Notepad", "", "Edit1")
    If UBound($cpos) = 0 Then Exit
    $mpos = MouseGetPos()
    If ($mpos[0] > $cpos[0]) and ($mpos[1] > $cpos[1]) and_
       ($mpos[0] < $cpos[2]) and ($mpos[1] < $cpos[3]) Then 
       MsgBox (0, "Message", "Mouse is over Edit1 control")
    Endif
Wend

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
×
×
  • Create New...