function TForm11.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of aeFinishedLaunching: Log('Finished Launching'); aeBecameActive: Log('Became Active'); aeWillBecomeInactive: Log('Will Become Inactive'); aeEnteredBackground: Log('Entered Background'); aeWillBecomeForeground: Log('Will Become Foreground'); aeWillTerminate: Log('Will Terminate'); aeLowMemory: Log('Low Memory'); aeTimeChange: Log('Time Change'); aeOpenURL: Log('Open URL'); end; Result := True; end;
Update: Delphi XE6 and Delphi XE7 version:
function TForm11.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin case AAppEvent of FinishedLaunching: Log('Finished Launching'); BecameActive: Log('Became Active'); WillBecomeInactive: Log('Will Become Inactive'); EnteredBackground: Log('Entered Background'); WillBecomeForeground: Log('Will Become Foreground'); WillTerminate: Log('Will Terminate'); LowMemory: Log('Low Memory'); TimeChange: Log('Time Change'); OpenURL: Log('Open URL'); end; Result := True; end;
Stop by Embarcadero’s Delphi Programming blog and review the full code and download the simple demo