On Aug 24, 2008, at 4:02 PM, Steve Cronin wrote:

NOTE: The info.plist has LSUIElement=1.
If the user designates the application to run as regular dock-based application then, early in startup, I do:

        ProcessSerialNumber psn = { 0, kCurrentProcess };
OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
        if( returnCode == 0) {
        ...

I have this working fine under Leopard, however, the application's deployment target is 10.4.
On the Tiger machines I'm getting a returnCode = -50.
GetMacOSStatusErrorString tells me that there is an error in the user parameters. I have examined the psn high = 0 and low = 2 which seems right to me...

The 10.4 application does NOT die; rather it continues to load and run EXCEPT there is no menu bar, no dock icon, and it is not listed in 'Force Quit'. (The TransformProcessType has failed.)

Is the LSUIElement confusing 10.4?
Was this a known bug on 10.4 that was never fixed?
Was there a 10.4 workaround?

Yes, not a bug, and no, I think. I think the function was never really intended to work with LSUIElement originally, only background- only (LSBackgroundOnly) apps, as it says in the docs. I'm not even sure it's supposed to work for LSUIElement on Leopard, even if you're finding that it does. In other words, I'm not sure that's guaranteed.

Honestly, the function is under-documented.


So here's my predicament:
I need the LSUIElement set to run as a statusItem (yes?)

If you mean as _only_ a status item, then yes.

LSUIElement cannot be changed by code (yes?)

Correct.

If I have this set LSUIElement then I can ONLY run as a status item in 10.4.

Well, you can run as an agent. An agent can put up windows, so it's not strictly limited to being a status item. A full-text search of the docs for LSUIElement will bring up a description. Anyway, you're correct that you (apparently) won't be able to transform into a normal foreground application.

If I do not set LSUIElement then I can NEVER run as a status item in either Leopard or Tiger....

Again, what you seem to mean is that you can never run as _just_ a status item with no Dock presence, menu bar, app switcher presence, Force Quit presence, etc. That's accurate.

On the other hand, there's nothing stopping a foreground application from putting up a status item.

I really don't want to deploy separate binaries for obvious reasons.

I think you should, even if TransformProcessType were guaranteed to work. I think that's a bad solution. Your status item should launch a proper foreground app if and when that's requested by the user. You can put one of the applications inside the bundle of the other so that users still see a single installable thing. I think the foreground app should be what the user sees in the Finder so that when s/he launches it, s/he gets a typical application experience. Then, that foreground app can offer to install the status item, which lives in the foreground app's bundle. It can then be added to the user's login items so it's always present. It would also know how to launch its "parent" app.

Cheers,
Ken
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to