Re: TransformProcessType() still doesn't show menu (Bug ID# 5905139)
Re: TransformProcessType() still doesn't show menu (Bug ID# 5905139)
- Subject: Re: TransformProcessType() still doesn't show menu (Bug ID# 5905139)
- From: Jim Correia <email@hidden>
- Date: Thu, 26 May 2011 19:32:32 -0700
On May 26, 2011, at 7:21 PM, Jerry Krinock wrote:
> I just thought I'd lift my head up long to say thank you, Anders. Unfortunately, your code doesn't work in my app. Tried several mutations; still no good.
>
> Another thing I learned is that programmatically switching apps, simulating the user typing cmd-tab, which works when the user does it, does not work when the program does it. I hard-coded pids of several running programs, activated each for 1 second, then activated my app. Looked very impressive until it got to my app, and the menu bar continued to show the previously-activated app.
This is an unfortunate bug, but you should be able to work around it with this sequence:
[[NSApplication sharedApplication] hide: nil];
ProcessSerialNumber psn = {0, kCurrentProcess};
verify_noerr(TransformProcessType(&psn, kProcessTransformToForegroundApplication));
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
—Jim
_______________________________________________
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