Re: Which app owns the menu bar?
Re: Which app owns the menu bar?
- Subject: Re: Which app owns the menu bar?
- From: Eric Schlegel <email@hidden>
- Date: Thu, 18 Oct 2007 13:32:06 -0700
On Oct 18, 2007, at 11:41 AM, Scott Guelich wrote:
By iterating, you mean with GetNextProcess()? I actually thought
about doing this, but the docs for GetNextProcess specifically say
that "the order of the list of processes is internal to the Process
Manager", so I interpreted that to mean I couldn't rely on the next
process being the next-most-frontmost.
When I just tried it this...
ProcrocessSerialNumber psn;
OSErr err = GetFrontProcess(&psn);
SGRequire( err == ERR_SUCCESS, ReturnNil, @"Failed to get front
process PSN" );
err = GetNextProcess(&psn);
SGRequire( err == ERR_SUCCESS, ReturnNil, @"Failed to get next
most front process PSN" );
...I get a -600 error for GetNextProcess(), which appears to map to
"procNotFound - No process in the process list following the
specified process". Am I doing something wrong?
OK, I asked the Process Manager engineer about this and he explained
what's going on. GetNextProcess actually iterates in bottom-up order,
not top-down. If you start with GetFrontProcess, there is no other
process in front of the front process, so GetNextProcess returns an
error.
Instead, you might try initializing your PSN to {kNoProcess,
kNoProcess}, and then calling GetNextProcess in a loop until you ran
out of processes. As you see each process, make a note of it if it's
not a UIElement or BGOnly process. When the loop is done, the last
process that you recorded is the frontmost non-UIElement/BGOnly app.
-eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden