Am 28.11.2007 um 02:34 schrieb Julie Porter:
void RegisterForEvents(WindowRef myWindow)
{
EventTypeSpec cmdEvent; cmdEvent.eventClass =
kEventClassCommand;
cmdEvent.eventKind = kEventProcessCommand;
EventHandlerUPP handlerUPP;
handlerUPP = NewEventHandlerUPP(CommandEventHandler);
EventTargetRef target;
target = GetWindowEventTarget(myWindow);
void * userdata = NULL;
InstallEventHandler(target, handlerUPP, 1, & cmdEvent,
userdata,NULL);
}
A UPP is a structure that wraps a function pointer. As such, you only
need it once for every function. What people generally do is define a
UPP as static to a function, and then they can allocate it once,
re-use it, and it gets disposed with the rest of the application on
shutdown.
That said, many of the UPP calls compile down to no-ops on OS X,
because they were mainly invented for calling 680x0 function on
PowerPC Macs, and thus in many cases you can just pass a straight
ProcPtr into UPP-expecting APIs.
Cheers,
-- M. Uli Kusterer
"The Witnesses of TeachText are everywhere..."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden