BBC BASIC for Windows
Programming >> Operating System >> ON CLOSE sometimes does not work http://bb4w.conforums.com/index.cgi?board=os&action=display&num=1423688127 ON CLOSE sometimes does not work
Post by g3nrw on Feb 11th, 2015, 7:55pm
I have incorporated an ON CLOSE statement in a program, giving the user the opportunity save settings when clicking on Windows Close (the "x" in the Title Bar). I followed the model in BB4W Help: Code:
ON CLOSE PROCclose : RETURN
REPEAT
REM Do something useful here!
UNTIL FALSE
;
DEF PROCclose : LOCAL ans$
REPEAT UNTIL INKEY(0) = -1
INPUT '"Do you really want to exit",ans$
IF LEFT$(ans$,1) = "y" OR LEFT$(ans$,1) = "Y" THEN QUIT
ENDPROC
This works as expected on 3 different Windows systems here (Win XP, Win 7/32, Win 8.1/64). When you click on "x", a message box pops up, giving you the option to click on "Yes/No/Cancel". No problem.
However, I have now had feedback from a Win 8.1/64 user, saying that when he clicks on the "x" to close the window, nothing at all happens. No "Yes/No/Cancel" message appears. Otherwise the program continues running normally, and the only way to stop it is to kill it with Windows Task Manager.
Has anyone here seen anything like this?
-- Ian Re: ON CLOSE sometimes does not work
Post by rtr2 on Feb 11th, 2015, 8:18pm
when he clicks on the "x" to close the window, nothing at all happens. No "Yes/No/Cancel" message appears. Otherwise the program continues running normally
What happens if you remove or disable the ON CLOSE? Does the window then close normally?
If you haven't already done so, it would be sensible to check whether the other methods of closing a window work:
Press Alt+F4.
Right-click in the title bar and select Close from the context menu.
Send a WM_CLOSE message from another application.
According to which of these work and which don't work you might be able to rule out possible causes.