Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how can i set parameters with my customized events




On Nov 1, 2009, at 9:01 PM, simon Scylla wrote:

I created a customized event,but I do not know how to set parameters with
it...
at the right now,my code is:


EventRef eventRef;
CreateEvent(NULL,kEventClassTimer,kEventTimerFire, 0,kEventAttributeNone,&eventRef);
SetEventParameter( eventRef, kEventParamAccessibleAttributeName,
typeCFStringRef, sizeof(CFStringRef), mask);


Is it wrong?
what should i do????

You're almost there:

SetEventParameter( eventRef, kEventParamAccessibleAttributeName,
typeCFStringRef, sizeof(CFStringRef), &cfString);

When handling the event:

GetEventParameter( eventRef, kEventParamAccessibleAttributeName, typeCFStringRef, nil, sizeof( CFStringRef ), nil, &cfString );

... use string
CFRelease(cfString)

or maybe

CFRetain(cfString)
... use string
CFRelease(cfString)

in which case the sender of the event can keep using the string too and release it eventually.

Jan E

_______________________________________________
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


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.