Re: sample code for notifications?
Re: sample code for notifications?
- Subject: Re: sample code for notifications?
- From: John Louch <email@hidden>
- Date: Sat, 12 Jul 2003 08:58:52 -0700
#include <ApplicationServices/ApplicationServices.h>
static void callback (AXObserverRef observer, AXUIElementRef element,
CFStringRef notification, void *refcon);
int main (int argc, char ** argv)
{
pid_t pid = atoi(argv[0])
AXUIElementRef app = AXUIElementCreateApplication (pid);
AXObserverRef observer;
AXObserverCreate (pid, callback, &observer);
AXObserverAddNotification (observer, app,
kAXWindowCreatedNotification, nil);
CFRunLoopAddSource (CFRunLoopGetCurrent(),
AXObserverGetRunLoopSource(observer), kCFRunLoopDefaultMode);
while (true)
CFRunLoopRun();
}
static void callback (AXObserverRef observer, AXUIElementRef element,
CFStringRef notification, void *refcon)
{
fprintf (stderr, "received notification: ")
CFShow (notification);
CFShow (element);
}
Here is a sample tool that registers for a notification. It was written
without a compiler, so there could be errors, and there is not error
checking.
Feel free to post your code snippet that is not working.
Thanks,
jl
On Saturday, July 12, 2003, at 4:04 AM, Ken Ferry wrote:
>
Does anybody know of (or have to post) some working code that
>
successfully registers to receive notifications from the accessibility
>
api?
>
>
It sure looks to me like I've followed what's in the docs, and yet I
>
receive no notifications (nor any errors).
>
>
Thanks,
>
-Ken
>
_______________________________________________
>
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.
_______________________________________________
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.