Re: Which app owns the menu bar?
Re: Which app owns the menu bar?
- Subject: Re: Which app owns the menu bar?
- From: Scott Guelich <email@hidden>
- Date: Thu, 18 Oct 2007 14:41:45 -0400
Hi Eric,
Thanks for the quick response!
I don't think there's any one-stop way to do this, but I think you
should get the right answer if you iterate over the process list,
starting with GetFrontProcess, and look for the first process that
is not a UIElement or BackgroundOnly process.
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?
Please also file a bug requesting an API to do this; we have this
capability in the OS, it's just not exposed as API.
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))
Scott
_______________________________________________
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