You are right, I've checked again with an empty program in BDS2006 and worked as you had suggested.
But if I debug my big program the behavior is different, so there something that has changed the rules in my code!
I need to check it...
Thank you for the suggestion about
AddExitProc(DoOnExit); // Put this line before Application.Run
I don't know it before...