Posts: 3
Threads: 1
Joined: Feb 2023
Reputation:
0
Hello everyone, I am using the QB64 for windows compatibility converted all the QB 4.5 to QB64 it has been working for 6 years now. Anyway one of my users asked me to disable the X on closing the program because they didn't want it to close in the middle of what they were doing so I put in the the command 'ex = _EXIT'. This works like it states you can't close the program with the X on the window. Now to kill the program when it freezes they have to kill the process in windows. Is there a why to use ON KEY to close it? I have tried ON KEY(1) with a subroutine and GOSUB it will not do the code when I press F1 so somehow the ON KEY is not working for me. I am using QB64 Version 1.1 Revision 20170120/51 does it work in more recent versions and where do I find them now. Alt + F4 should be what the Window close X button uses I think but maybe I am wrong.
Is there anyone that may know something to help me or should I leave it the way it is.
Posts: 730
Threads: 30
Joined: Apr 2022
Reputation:
43
02-08-2023, 07:40 PM
(This post was last modified: 02-08-2023, 07:41 PM by SpriggsySpriggs.)
When you catch the _EXIT, you can check how they were trying to close it and then use SYSTEM to close. Looking at the
Wiki page on _EXIT, the function returns what method the user was using to attempt to close the program. If they pressed the X, you can just ignore it. If you wanted it to close on CTRL + BREAK, like in the example, you could then use SYSTEM when the return value matches.
Tread on those who tread on you
Posts: 3
Threads: 1
Joined: Feb 2023
Reputation:
0
Thank You everyone I got it to recognize F4 and then I ask if they really want to exit and only accept y to exit
Yes an old program started in the 80s and I started on it in 2017 and brought it over to QB64. It is 100,000 lines of code but only am touching it when they need to add or change stored in the program variables I told them it is the wrong way to do it started to import from csv files but they don't change too often. So I maintain while building an order entry system for them in FULLSTACK which was also new for me. BASIC I USED way back in 1987 then never touched again until 2016.
Thanks Again all is working or will be working as I expect still testing it.
Ron.