Sometimes we want to do something between procedures or form switches, but not so self-heart, you can't get it, it is very confused. Here is a slight discussion on this issue, I hope to help people need.
??? Onactivate in general is the onactivate of the form, not the program level, that is, not the Application level. So you are on the window onactivate is the switch between the windows, the rules are as follows: ??? 1. When the system starts, the main window will get onactivate events. ??? 2. When other non-mode windows are switched to other windows, the onActivate events of the current window will cause. ??? 3. The mode window does not cause the onactivate event that gets the focus window. ??? 4. Two Application or other folders with mutual switching without causing an onactivate event for the focus window, this event is an Application level, so it does not cause the window level event.
??? If you want to get the Application level onactivate event, you need: Join a TapplicationEvents control (on the Additional toolbar). Then write the code in its onactivate event, you can.