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 11:51:48 -0700
On Oct 18, 2007, at 11:41 AM, Scott Guelich wrote:
By iterating, you mean with GetNextProcess()?
Yes.
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.
I believe the order actually can be relied on to be front-to-back.
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?
Hmm, that's odd. I would not expect that. Is that on Tiger or Leopard?
Definitely will do. I suppose if I have to, I could always fall back
to using NSAppleScript in the meantime, since something like the
following does seem to give me the right answer consistently:
tell application "System Events" to get the unix id of the first
process whose bundle identifier is the bundle identifier of the
(info for the (path to frontmost application))
Or you could also use the NSApplication method that Bill Cheeseman
recommended.
-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