Jump to content

Recommended Posts

Posted (edited)

how can i check if a mouse is down over a specific control?

also I cant figure out how to change a picture of my control button on my window when my mouse clicks on it without it closing.

help?

Edited by nowagain
Posted

1.

#include <GuiConstantsEx.au3>
#include <Misc.au3>

Global $aPos[4]
Global $DllHandle = DllOpen("user32.dll")

$hGUI = GUICreate("Test GUI", 200, 100)

$button = GUICtrlCreateButton("Test", 60, 40, 75, 23)

GUISetState()

Do
    $aPos = GUIGetCursorInfo()
    If (_IsPressed("01", $DllHandle) = 1) Then
        
        While (_IsPressed("01", $DllHandle) = 1) And ($aPos[4] = $button)
            ConsoleWrite("Hover" & @LF)
        WEnd
        
    EndIf
Until GUIGetMsg() = $GUI_EVENT_CLOSE

2.

GUICtrlSetImage()

Posted (edited)

Ok, but I dont understand where is it in your code I should put GUICtrlSetImage()

your code also throws an error when i open up notepad

it says:

Error: Subscript used with non-array variable

on the line:

While (_IsPressed("01", $DllHandle) = 1) And ($aPos[4] = $XIcon1)

Edited by nowagain
Posted

Still don`t understand completely what you want:

#include <GuiConstantsEx.au3>
#include <Misc.au3>
#include <ButtonConstants.au3>

Global $aPos
Global $DllHandle = DllOpen("user32.dll")
Global $once = False

$hGUI = GUICreate("Test GUI", 200, 100)

$button = GUICtrlCreateButton("Test", 60, 40, 75, 23, $BS_ICON)

GUISetState()

Do
    $aPos = GUIGetCursorInfo()
    If ($once = False) And (_IsPressed("01", $DllHandle) = 1) And (IsArray($aPos)) Then
        $once = True
        GUICtrlSetImage($button, "shell32.dll", 154, 0)
    ElseIf ($once = True) And (_IsPressed("01", $DllHandle) = 0) And (IsArray($aPos)) Then
        $once = False
        GUICtrlSetImage($button, "shell32.dll", 155, 0)
    EndIf
Until GUIGetMsg() = $GUI_EVENT_CLOSE

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...