That's right. The engine has hard-code to terminate on ESC, and it's hooked at a lower level than code execution. This means that if the user hits ESC, the engine will interpret it as a terminate before the code is allowed to detect that ESC has been pressed.
Using DISABLE ESCAPEKEY near the top of your program will switch off this lowlevel hook, so that it will no longer terminate. Your program will then be able to catch it to use any way you like.
If you disable escape, you'll need to code another means of exiting your program or the user will be restricted to ALT-F4 or hitting the close button in the caption bar.