Jump to content

prevent a window close event


gadzail
 Share

Recommended Posts

Hi,

I would like to prevent an accidentally mouseclick on the close button of a window program.

I have a program to test and it is quite slow so if I accidentally close the program it takes a lot of time to restart.

It could be helpful a messagebox that ask me if I am sure to do that.

Do you know how?

Link to comment
Share on other sites

You could throw up a GUI or a SplashText to cover the close button until after you are done testing.

maybe try "ANYGUI.au3" in Example scripts

maybe place a label or something over the exit button and when it is clicked it will bring up a message box

just one idea/direction

8)

EDIT: great minds think alike... but i was too slow!!!

It works... a Splashtext is perfect.

Thanks all.

I wrote this code (about the msgbox I will do it):

OPT ("WinTitleMatchMode" , 2 )
TrayTip ("xx", " some text " & @CRLF, 10 , 1)

HotKeySet("+!d", "F_exit")
AdlibEnable("F_checkClose")
while 1
    sleep(100)
wend

Func F_checkClose()
    ConsoleWrite(@CRLF&"check")
    If WinExists("titlewindow") Then
        $size = WinGetPos("titlewindow")
        $xs=$size[0]+$size[2]-21
        $ys=$size[1]-1
        if WinActive("titlewindow") Then
            SplashTextOn("", " X ", 18, 18, $xs, $ys, 1+32, "")
        Else
            SplashOff()
        EndIf
    Else
        SplashOff()
    EndIf
EndFunc

Func F_exit()
    Exit
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...