Unfortunately not. You can convert a background application to a foreground application using the TransformProcessType() function, but you cannot go from a foreground application to a background application.
Here's how to go from the background to the foreground:
ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); if( returnCode != 0) { NSLog(@"Could not bring the application to front. Error %d", returnCode); }
source share