How To Detect If MT4 Main Window Is Being Closed Down

 

Hi Guys

I want to create a script where whenever I want to close down an MT4 program, an alert box is displayed to remind me to save an important profile to an external harddrive before MT4 is closed down. So I need to detect whenever the MT4 main window is being closed down. What is the code to detect the MT4-close-down event? I would really appreciate if someone can help me out. Thanks in advance

 
CHONG WEE CHUNG: alert box is displayed to remind me

Can't be done. On chart/terminal close, all indicators/EA call their onDeinit(). That has two seconds to do whatever and exit. You can not run something else. You can not display a box and wait for action.

Reason: