Re: Sending Apple events to yourself
Re: Sending Apple events to yourself
- Subject: Re: Sending Apple events to yourself
- From: Gregory Weston <email@hidden>
- Date: Wed, 12 Jul 2006 23:21:45 -0400
David Alter wrote:
I'm working on a plugin to an application. I can sent Apple Events to
the application to do things and that works fine. Now I have
situation where I need to get the reply. This always results in an
event timeout.
Can a plugin send and Apple Event to its parent Application and get
the reply?
Absolutely.
If so what do I need to do? I found a tech note on sending
events to your self but it was pre OSX and I question if it is still
valid.
Yep.
<http://developer.apple.com/technotes/ic/ic_01.html> Not to
mention I'm trying to isolate myself from as much of the guts of
Apple Events as I can, by using the Cocoa API and not carbon.
Um. That's probably unnecessarily complicating things. Here are the
most likely failure points.
1: You should provide an idle handler.
pascal Boolean MyIdleFunction(EventRecord* event, long* sleepTime,
RgnHandle* mouseRgn)
{
#pragma unused(event)
*sleepTime = 30;
*mouseRgn = nil;
return false;
}
2: The most efficient addressing method is a ProcessSerialNumber set
up like this.
thePSN.highLongOfPSN = 0;
thePSN.lowLongOfPSN = kCurrentProcess;
3: And there's the actual call once you've constructer the request.
theResult = AESend(&theRequest, &theReply, kAEWaitReply,
kAENormalPriority, kNoTimeOut, MyIdleFunction,
NULL);
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden