AustrianOak Posted June 3, 2008 Share Posted June 3, 2008 (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 June 3, 2008 by nowagain Link to comment Share on other sites More sharing options...
rasim Posted June 3, 2008 Share Posted June 3, 2008 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_CLOSE2.GUICtrlSetImage() Link to comment Share on other sites More sharing options...
AustrianOak Posted June 3, 2008 Author Share Posted June 3, 2008 (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 June 3, 2008 by nowagain Link to comment Share on other sites More sharing options...
rasim Posted June 3, 2008 Share Posted June 3, 2008 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now