Jump to content
Sign in to follow this  
computergroove

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

Recommended Posts

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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...