Register for system-wide notifications?
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.