It's been about 8 years since I used this feature, and apparently, back then, it did not trap Alt + F4 (The Windows key combo that kills an active window.) I have QB64 v 1.3, and in my version it does trap that event, perfectly. However, the Wiki gives no mention of this. Of all the other various ways to trap keys, INP(96), _KEYDOWN, PEEK(1024), INKEY$, and _KEYHIT, I'm inclined to believe the _EXIT statement is the only way to trap Alt + F4.
Any disagreement here?In this one example, note that _EXIT saves the day, as the ON KEY statement fails to trap the Alt + F4 key press combo...
ON KEY(15) GOSUB alt_F4_trap
' User defined key press. KEY(15) ON ' Event trapping on. PRINT "Press Alt + F4 for terminate warning."
alt_F4_trap:
So if you run the example, you can see that only _EXIT traps the Alt + F4 event. I think if someone is up to it, with Wiki account rights, this should be included in the Wiki for all key statements, and especially for _EXIT, which was apparently updated some time past 2018. Thanks to whomever for that, great addition! Oh, if you have posting ability at Stackoverflow, you might want to amend that thread, as well...
https://stackoverflow.com/questions/49567587/trap-alt-f4-in-qb64Pete