• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Switching between background <-> foreground app type at run-time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Switching between background <-> foreground app type at run-time


  • Subject: Switching between background <-> foreground app type at run-time
  • From: vance <email@hidden>
  • Date: Wed, 26 Sep 2007 11:06:14 -0700


How do I switch between BackgroundOnly (has no doc icon and menu) and Foreground (has dock icon and menu) application at runtime, both ways?


I am writing a small tool that display temperature on the status. From the drop down menu a user can select "Configure" in which case i would like to put a dock icon and system menu, and go back to background only application once the "config window" is closed.

This is what I found so far:

1. Setting LSBackgroundOnly or LSUIElement in Info.plist to "1" makes the application without a dock icon and menu.

Problem: This only works when the application is started, I need to be able to change in during run-time back and forth.

2. "TransformProcessType(&psn, kProcessTransformToForegroundApplication);" can change background only app (LSBackgroundOnly in Info.plist set to 1) to a foreground application with a dock icon and menu.

Problem: This only works one way (from background to foreground). Need a way to go backwards as well (foreground to background) to have this to be a viable solution

3. Have 2 different applications: One with LSBackgroundOnly set to 1, that creates the status item and Another one without

Problem: They will be 2 different processes and a lot of interprocess communication needs to be used between. Not very sure the proper IPC mechanism to be used here. Plus I have to maintain 2 different binaries instead of one for a very simple tool I am creating.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Switching between background <-> foreground app type at run-time
      • From: Charles Steinman <email@hidden>
    • Re: Switching between background <-> foreground app type at run-time
      • From: Mike Blaguszewski <email@hidden>
    • Re: Switching between background <-> foreground app type at run-time
      • From: Eric Schlegel <email@hidden>
  • Prev by Date: Re: creating classes on the fly ??
  • Next by Date: Re: creating classes on the fly ??
  • Previous by thread: Re: Textures Alpha blending problems with Transparent NSOpenGLView
  • Next by thread: Re: Switching between background <-> foreground app type at run-time
  • Index(es):
    • Date
    • Thread