Sign in to follow this  
Followers 0
computergroove

Is there a way to close a GuiCreate window within the program?

4 posts in this topic

I want to have a button show up on the screen in one position and then after 3 seconds have that window disappear and then reappear in a new position. This is what I have come up with so far but I dont know hoe to close the window after it is created. What I end up with is 2 buttons on the screen at the same time. Also is there a more efficient way to do this than just copy the entire program and separate it by the sleep command?

While 1
    ;Sleep(11)
    Sleep(3000)
GUICreate("MAC Hovering Button", $width, $height, @DesktopWidth - $width, 1, $WS_POPUP, $WS_EX_TOPMOST); creates the button window
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit"); if the window is closed then the program will exit
$Button1 = GUICtrlCreatePic("c:\Program Files\AutoIt3\Examples\GUI\MACFinal200x188.jpg", -1, -1, $width, $height); places a picture in the window
GUICtrlSetState(-1, $GUI_DISABLE);When disabled this line prevents the button from doing abything when pressed
$b1label = GUICtrlCreateLabel("", 1, 1, $width, $height, 0x201);creates a frame in the window that reacts when clicked
GUICtrlSetBkColor($b1label, $GUI_BKCOLOR_TRANSPARENT); when disbaled this line prevents a picture from showing up in the window
GUICtrlSetOnEvent($b1label, "Change"); calls the change function when the button is pressed
GUISetState()
    Sleep(3000)
GUICreate("MAC Hovering Button", $width, $height, @DesktopWidth - $width, 350, $WS_POPUP, $WS_EX_TOPMOST); creates the button window
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit"); if the window is closed then the program will exit
$Button1 = GUICtrlCreatePic("c:\Program Files\AutoIt3\Examples\GUI\MACFinal200x188.jpg", -1, -1, $width, $height); places a picture in the window
GUICtrlSetState(-1, $GUI_DISABLE);When disabled this line prevents the button from doing abything when pressed
$b1label = GUICtrlCreateLabel("", 1, 1, $width, $height, 0x201);creates a frame in the window that reacts when clicked
GUICtrlSetBkColor($b1label, $GUI_BKCOLOR_TRANSPARENT); when disbaled this line prevents a picture from showing up in the window
GUICtrlSetOnEvent($b1label, "Change"); calls the change function when the button is pressed
GUISetState()
    $BPosV = 1
WEnd

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites



OK it looks like GUIDelete()gets the job done however when the new window is created it becomes the focused window. Is there any way to prevent that?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Maybe the $WS_DISABLED GUI Control Style will work.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Maybe the $WS_DISABLED GUI Control Style will work.

When I add that the program no longer created a window. What is the syntax of that many options?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
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
Sign in to follow this  
Followers 0