• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Register for system-wide notifications?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Register for system-wide notifications?


  • Subject: Register for system-wide notifications?
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Thu, 12 Sep 2002 22:44:39 +0200

Hi,

I want to have my Carbon MachO application read out window titles as a window is brought to front (no matter what application it is in). But I'm getting an kAXErrorInvalidUIElement from AXUIElementGetPid().

So, does anyone know how I can register system-wide for notifications?

Here's what I tried:

if( AXAPIEnabled() )
{
AXUIElementRef vComputer;
pid_t vComputerPID;
AXError err;
AXObserverRef vComputerObserver;
CFRunLoopSourceRef vObserverSource;
CFRunLoopRef vCurrentRL;

vComputer = AXUIElementCreateSystemWide();
err = AXUIElementGetPid( vComputer, &vComputerPID );
if( err == kAXErrorSuccess )
throw std::runtime_error( "Can't get PID of System." );
err = AXObserverCreate( vComputerPID, MooseObserverCallback, &vComputerObserver );
if( err == kAXErrorSuccess )
throw std::runtime_error( "Can't get Observer for System." );
CFRelease( vComputer );

vObserverSource = AXObserverGetRunLoopSource( vComputerObserver );
vCurrentRL = CFRunLoopGetCurrent();
CFRunLoopAddSource( vCurrentRL, vObserverSource, kCFRunLoopDefaultMode );
err = AXObserverAddNotification( vComputerObserver, vComputer, kAXMainWindowChangedNotification, this );
if( err == kAXErrorSuccess )
throw std::runtime_error( "Can't register for window changes." );

CFRelease( vComputerObserver );
}
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Carbon App: Doesn't read tab headings, doesn't focus sliders?
  • Next by Date: Re: Carbon App: Doesn't read tab headings, doesn't focus sliders?
  • Previous by thread: Re: Carbon App: Doesn't read tab headings, doesn't focus sliders?
  • Next by thread: Re: Register for system-wide notifications?
  • Index(es):
    • Date
    • Thread