Sign in to follow this  
Followers 0
flyingboz

How To Kill Script Along W/ Window

5 posts in this topic

My first GUI is working beautifully - thanks to all who have participated in making

this functionality available.

How do I detect a mouseclick closing the GUI on the titlebar ?

if someone clicks the X to kill the entire window, the GUI obediently goes

away, but my script does not stop running.

What should I be testing for to make the script die, too?


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites



Thanks for the insight ... Have it working now.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

I would recommend using Opt("WinTitleMatchMode", 4). Then create a global variable to store the HWND of the GUI. GuiCreate() returns the HWND, so do something like:

$g_hWnd = "handle=" & CreateGui()

Then use a While loop like:

While WinExists($g_hWnd)
    Local $msg = GuiMsg(0)
   If $msg = -3 Then
       GuiDelete(); This will cause the loop to end
    EndIf
WEnd

Share this post


Link to post
Share on other sites

Valik,

Thanks for the input - that helps too. I already had the loop going on - I just missed checking for the possibility of negative return values from the guimsg()

command - I see how using the hwnd would be very useful for more complex (multiple/interacting) GUIs.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

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