Which app owns the menu bar?
Which app owns the menu bar?
- Subject: Which app owns the menu bar?
- From: Scott Guelich <email@hidden>
- Date: Thu, 18 Oct 2007 13:41:57 -0400
I know this has been asked dozens of times, but unfortunately none of
the answers I've found solves my problem. I'm working on an
accessibility utility and am trying to determine the frontmost app...
specifically the app that owns the menu bar.
The standard answer is "Use GetFrontProcess()," but unfortunately that
can sometimes return LSUIElement apps, even though they don't have
menu bars. For example, if I create an Xcode project and set
LSUIElement to 1, and then run it with the following code, I get info
back info on my own process instead of Xcode (which owns the menu bar):
GetFrontProcess(&psn);
CFShow( ProcessInformationCopyDictionary( &psn,
kProcessDictionaryIncludeAllInformationMask ) );
I also tried the following:
* Using AXUIElementCopyAttributeValue system-wide with
kAXFocusedApplicationAttribute... same problem as above, it returns
the LSUIElement app.
* Iterating over open applications looking for kAXFrontmostAttribute
set to true... again, the same result.
* Using AXUIElementCopyElementAtPosition system-wide at (5.0, 5.0),
hoping I hit the active menu bar... this works, but feels like an ugly
hack that a 3rd party utility could easily break.
Is there some simple way to do this that I've missed? Thanks...
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