本文整理汇总了C++中AECreateDesc函数的典型用法代码示例。如果您正苦于以下问题:C++ AECreateDesc函数的具体用法?C++ AECreateDesc怎么用?C++ AECreateDesc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AECreateDesc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: newdescwithhandle
boolean newdescwithhandle (AEDesc *desc, DescType typeCode, Handle h) {
/*
PBS 03/14/02: Create a new AEDesc with the given type and value.
*/
OSErr err = noErr;
long len = gethandlesize (h);
AEInitializeDescInline (desc);
if (h == nil)
err = AECreateDesc (typeCode, nil, 0, desc);
else {
lockhandle (h);
err = AECreateDesc (typeCode, *h, len, desc);
unlockhandle (h);
} /*else*/
return (err == noErr);
} /*newdescwithhandle*/
开发者ID:dvincent,项目名称:frontier,代码行数:26,代码来源:aeutils.c
示例2: DestoryWacomContext
// DestoryWacomContext
//
// This function will instruct the Tablet Driver to delete a context that your
// application created. Please be nice and destroy all contexts you create
// before your application quits.
//
// parameters: UInt32 contextID - The ID returned to you when you created the
// context.
//
// returns: a contextID and noErr on success, else an AE error code
//////////////////////////////////////////////////////////////////////////////
OSErr DestoryWacomContext(UInt32 contextID)
{
AEDesc driverTarget,nullDesc,keyData,tObjSpecifier;
AppleEvent aeSend;
OSErr err;
err = GetTabletDriverTarget(&driverTarget);
if(err)
{
return err;
}
err = AECreateAppleEvent(kAECoreSuite,
kAEDelete,
&driverTarget,
kAutoGenerateReturnID,
kAnyTransactionID,
&aeSend);
// Now tell the AE what to destroy
//Create NULL AEDesc, this will signify the end of the AEDesc Chain
AEInitializeDesc(&nullDesc);
err = AECreateDesc( typeNull, NULL, NULL, &nullDesc );
AEInitializeDesc(&keyData);
err = AECreateDesc( typeUInt32,
&contextID, // This is the context ID we want to destroy
sizeof(contextID),
&keyData );
err = CreateObjSpecifier(cContext, // We want to destroy a context
&nullDesc, // This is the last item in the chain
formUniqueID, // use id to determine which context to destroy
&keyData, // This is the Context ID descriptor created above
TRUE, // delete the nullDesc, and KeyData descriptor for us
&tObjSpecifier); // The created descriptor which says that we want to delete Context X
err = AEPutParamDesc( &aeSend, keyDirectObject, &tObjSpecifier);
// Finally send the event
err = AESend(&aeSend, // The complete AE we created above
NULL, // Don't need a reply
kAEWaitReply,
kAEHighPriority,
kDefaultTimeOut,
NULL,
NULL);
AEDisposeDesc(&tObjSpecifier);
AEDisposeDesc(&aeSend);
开发者ID:CNMAT,项目名称:CNMAT-Externs,代码行数:60,代码来源:TAEHelpers.c
示例3: SendAppleEventToSystemProcess
OSStatus SendAppleEventToSystemProcess(AEEventID eventToSendID)
{
AEAddressDesc targetDesc;
static const ProcessSerialNumber kPSNOfSystemProcess = {0, kSystemProcess };
AppleEvent eventReply = {typeNull, NULL};
AppleEvent eventToSend = {typeNull, NULL};
OSStatus status = AECreateDesc(typeProcessSerialNumber,
&kPSNOfSystemProcess, sizeof(kPSNOfSystemProcess), &targetDesc);
if (status != noErr)
return status;
status = AECreateAppleEvent(kCoreEventClass, eventToSendID,
&targetDesc, kAutoGenerateReturnID, kAnyTransactionID, &eventToSend);
AEDisposeDesc(&targetDesc);
if (status != noErr)
return status;
status = AESendMessage(&eventToSend, &eventReply, kAENormalPriority, kAEDefaultTimeout);
AEDisposeDesc(&eventToSend);
if (status != noErr)
return status;
AEDisposeDesc(&eventReply);
return status;
}
开发者ID:moatstormer,项目名称:mrmc,代码行数:30,代码来源:CocoaPowerSyscall.cpp
示例4: PyMac_PRECHECK
static PyObject *AE_AECreateDesc(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
DescType typeCode;
char *dataPtr__in__;
long dataPtr__len__;
int dataPtr__in_len__;
AEDesc result;
#ifndef AECreateDesc
PyMac_PRECHECK(AECreateDesc);
#endif
if (!PyArg_ParseTuple(_args, "O&s#",
PyMac_GetOSType, &typeCode,
&dataPtr__in__, &dataPtr__in_len__))
return NULL;
dataPtr__len__ = dataPtr__in_len__;
_err = AECreateDesc(typeCode,
dataPtr__in__, dataPtr__len__,
&result);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
AEDesc_New, &result);
return _res;
}
开发者ID:AdminCNP,项目名称:appscript,代码行数:25,代码来源:_AEmodule.c
示例5: BigSendAppleEvent
OSErr BigSendAppleEvent(TargetID *targ,AEEventClass aeClass,AEEventID aeID,Ptr *data,short dataLen,DescType dataType,Boolean returnData,Boolean checkForHandlerErr)
{
AEAddressDesc targDesc={typeNull, nil}; // Desc for target
AppleEvent appOut={typeNull, nil},appIn={typeNull, nil};
short sendMode=kAENeverInteract;
OSErr err;
if (returnData || checkForHandlerErr)
sendMode+=kAEWaitReply;
else
sendMode+=kAENoReply;
// Create the address desriptor
err=AECreateDesc(typeTargetID,(Ptr)targ,sizeof(TargetID), &targDesc);
if (err)
return err;
// now create the apple event which will be sent
err=AECreateAppleEvent(aeClass,aeID,&targDesc,kAutoGenerateReturnID,kAnyTransactionID,&appOut);
if (err)
{
AEDisposeDesc(&targDesc);
return err;
}
if (data && *data)
{
err=AEPutParamPtr(&appOut,keyDirectObject,typeChar,*data,dataLen);
DisposePtr(*data);
*data=0L;
if (err)
{
AEDisposeDesc(&appOut);
AEDisposeDesc(&targDesc);
}
}
// Send the apple event
err=AESend(&appOut,&appIn,sendMode,kAENormalPriority,kAEDefaultTimeout,0L,0L);
if (err)
{
AEDisposeDesc(&appOut); // get rid of the apple events
AEDisposeDesc(&appIn);
AEDisposeDesc(&targDesc); // and the address descriptor
}
if (returnData) // get info from reply event
err=FetchParamAnySize(keyDirectObject,&appIn,data,dataType);
// Get the error returned if any
if (!err && checkForHandlerErr)
err=FetchAEErr(&appIn);
// The apple event has been sent, dispose of descriptors
AEDisposeDesc(&appOut); // get rid of the apple events
AEDisposeDesc(&appIn);
AEDisposeDesc(&targDesc); // and the address descriptor
return err;
}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:60,代码来源:AppleEvents.cpp
示例6: IACnewsystemverb
Boolean IACnewsystemverb (OSType vclass, OSType vtoken, AppleEvent *event) {
/*
6/29/92 DW: special entry point for messages sent to system event handlers.
implementation detail: this is accomplished by sending the message to ourself.
*/
AEAddressDesc adr;
OSErr ec;
ProcessSerialNumber psn;
psn.highLongOfPSN = 0;
psn.lowLongOfPSN = kCurrentProcess;
AECreateDesc (typeProcessSerialNumber, (Ptr) &psn, sizeof (psn), &adr);
ec = AECreateAppleEvent (
vclass, vtoken, &adr, kAutoGenerateReturnID, kAnyTransactionID, event);
AEDisposeDesc (&adr);
IACglobals.errorcode = ec;
return (ec == noErr);
} /*IACnewsystemverb*/
开发者ID:pombredanne,项目名称:Frontier,代码行数:29,代码来源:iacnewsystemverb.c
示例7: StopRecorder
void StopRecorder(PRECORDER_PARM prec)
{
OSAEvent theOSAEvent; /* the apple event you are generating */
AEAddressDesc targetaddr; /* the address descriptor for target app */
PID thePID;
OSErr rc = noErr;
if (prec->recording)
{
rc = AERemoveEventHandler( kCoreEventClass,
kAENotifyRecording,
(AEEventHandlerUPP)RawEventRecordingProc,
FALSE );
pmassert(prec->pmp->hab, rc == noErr );
prec->recording = FALSE;
rc = AEGetPID(APP_NAME, &thePID);
rc = AECreateDesc(typePID, &thePID, sizeof(thePID), &targetaddr);
rc = AECreateOSAEvent(kCoreEventClass,
kAEStopRecording,
&targetaddr,
kAutoGenerateReturnID,
kAnyTransactionID,
&theOSAEvent);
rc = AESend(&theOSAEvent,
NULL,
kAENoReply,
kAENormalPriority,
kAEDefaultTimeout,
NULL,
NULL);
}
}
开发者ID:OS2World,项目名称:DEV-SAMPLES-The-IBM-Developer-Connection-Release-12,代码行数:32,代码来源:TESTREC.CPP
示例8: putMissingValueToReply
OSErr putMissingValueToReply(AppleEvent *reply)
{
const static DescType missingValue = cMissingValue;
OSErr err;
AEDesc resultDesc;
AECreateDesc(typeType, &missingValue, sizeof(missingValue), &resultDesc);
err=AEPutParamDesc(reply, keyAEResult, &resultDesc);
AEDisposeDesc(&resultDesc);
return err;
}
开发者ID:tkurita,项目名称:AEUtils,代码行数:10,代码来源:AEUtils.c
示例9: error
/* LowRunAppleScript compiles and runs an AppleScript
provided as text in the buffer pointed to by text. textLength
bytes will be compiled from this buffer and run as an AppleScript
using all of the default environment and execution settings. resultData
must be non-NULL, and should have been previously initialised, for example
with _hs_initNull. The result returned by the execution
command will be returned as typeUTF8Text in this descriptor record
(or typeNull if there is no result information). If the function
returns errOSAScriptError, then resultData will be set to a
descriptive error message describing the error (if one is
available). */
OSStatus LowRunAppleScript(const void* text, long textLength, AEDesc *resultData) {
ComponentInstance theComponent;
AEDesc scriptTextDesc;
OSStatus err;
OSAID scriptID, resultID;
/* set up locals to a known state */
theComponent = NULL;
AECreateDesc(typeNull, NULL, 0, &scriptTextDesc);
scriptID = kOSANullScript;
resultID = kOSANullScript;
/* open the scripting component */
theComponent = OpenDefaultComponent(kOSAComponentType,
typeAppleScript);
if (theComponent == NULL) { err = paramErr; goto bail; }
/* put the script text into an aedesc */
err = AECreateDesc(typeUTF8Text, text, textLength, &scriptTextDesc);
if (err != noErr) goto bail;
/* compile the script */
err = OSACompile(theComponent, &scriptTextDesc,
kOSAModeNull, &scriptID);
if (err != noErr) goto bail;
/* run the script/get the result */
err = OSAExecute(theComponent, scriptID, kOSANullScript,
kOSAModeNull, &resultID);
if (resultData != NULL) {
if (err == noErr && resultID != kOSANullScript) {
OSADisplay(theComponent, resultID, typeUTF8Text,
kOSAModeNull, resultData);
}
}
bail:
if (err == errOSAScriptError) {
AECreateDesc(typeNull, NULL, 0, resultData);
OSAScriptError(theComponent, kOSAErrorMessage, typeUTF8Text, resultData);
}
AEDisposeDesc(&scriptTextDesc);
if (scriptID != kOSANullScript) OSADispose(theComponent, scriptID);
if (resultID != kOSANullScript) OSADispose(theComponent, resultID);
if (theComponent != NULL) CloseComponent(theComponent);
return err;
}
开发者ID:adinapoli,项目名称:haskell-AppleScript,代码行数:53,代码来源:RunScript.c
示例10: SendOpenAE
OSStatus SendOpenAE( AEDescList list )
{
OSStatus err;
AEAddressDesc theAddress;
AppleEvent dummyReply;
AppleEvent theEvent;
theAddress.descriptorType = typeNull;
theAddress.dataHandle = NULL;
dummyReply.descriptorType = typeNull;
dummyReply.dataHandle = NULL;
theEvent.descriptorType = typeNull;
theEvent.dataHandle = NULL;
do {
ProcessSerialNumber psn;
err = GetCurrentProcess(&psn);
if ( err != noErr) break;
err =AECreateDesc(typeProcessSerialNumber, &psn, sizeof(ProcessSerialNumber), &theAddress);
if ( err != noErr) break;
err = AECreateAppleEvent(kCoreEventClass, kAEOpenDocuments, &theAddress, kAutoGenerateReturnID, kAnyTransactionID, &theEvent);
if ( err != noErr) break;
err = AEPutParamDesc(&theEvent, keyDirectObject, &list);
if ( err != noErr) break;
err = AESend(&theEvent, &dummyReply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, NULL, NULL);
if ( err != noErr) break;
} while (false);
if ( theAddress.dataHandle != NULL )
{
AEDisposeDesc( &theAddress );
}
if ( dummyReply.dataHandle != NULL )
{
AEDisposeDesc( &dummyReply );
}
if ( theEvent.dataHandle != NULL )
{
AEDisposeDesc( &theEvent );
}
return err;
}
开发者ID:fruitsamples,项目名称:SimpleText,代码行数:54,代码来源:NavigationServicesSupport.c
示例11: AEDescCreateUnicodeText
OSErr AEDescCreateUnicodeText(CFStringRef string, AEDesc* outDescPtr)
{
OSErr err = noErr;
DescType resultType = typeUnicodeText;
UniCharCount length = CFStringGetLength(string);
const UniChar *constBuff = CFStringGetCharactersPtr(string);
if (constBuff == NULL) {
UniChar *buffer;
buffer = malloc(sizeof(UniChar)*length);
CFStringGetCharacters(string, CFRangeMake(0, length), buffer);
err = AECreateDesc(resultType, buffer, sizeof(UniChar)*length, outDescPtr);
free(buffer);
}
else {
err=AECreateDesc(resultType, constBuff, length*sizeof(UniChar), outDescPtr);
}
return err;
}
开发者ID:tkurita,项目名称:AEUtils,代码行数:20,代码来源:AEUtils.c
示例12: AddIDToAEList
// NOTE: AELists have 1-based indexes
OSErr AddIDToAEList(unsigned int id_num, long index, DescType object_type, AEDescList* list)
{
AEDesc item_desc;
AECreateDesc(typeNull, NULL, 0, &item_desc);
OSStatus err = CreateAEDescFromID(id_num, object_type, &item_desc);
if (noErr == err)
{
err = AEPutDesc(list, index, &item_desc);
AEDisposeDesc(&item_desc);
}
return err;
}
开发者ID:prestocore,项目名称:browser,代码行数:13,代码来源:AppleEventUtils.cpp
示例13: AEDescCreateUTF8Text
OSErr AEDescCreateUTF8Text(CFStringRef string, AEDesc* outDescPtr)
{
OSErr err = noErr;
CFStringEncoding kEncoding = kCFStringEncodingUTF8;
DescType resultType = typeUTF8Text;
const char *constBuff = CFStringGetCStringPtr(string, kEncoding);
if (constBuff == NULL) {
char *buffer;
CFIndex charLen = CFStringGetLength(string);
CFIndex maxLen = CFStringGetMaximumSizeForEncoding(charLen, kEncoding)+1; // +1 is for null termination.
buffer = malloc(sizeof(char)*maxLen);
CFStringGetCString(string, buffer, maxLen, kEncoding);
err = AECreateDesc(resultType, buffer, strlen(buffer), outDescPtr);
free(buffer);
}
else {
err=AECreateDesc(resultType, constBuff, strlen(constBuff), outDescPtr);
}
return err;
}
开发者ID:tkurita,项目名称:AEUtils,代码行数:21,代码来源:AEUtils.c
示例14: putAliasToReply
OSErr putAliasToReply(AliasHandle inAlias, AppleEvent *reply)
{
OSErr err;
AEDesc resultDesc;
HLock((Handle)inAlias);
err = AECreateDesc(typeAlias, (Ptr) (*inAlias),
GetHandleSize((Handle) inAlias), &resultDesc);
HUnlock((Handle)inAlias);
err=AEPutParamDesc(reply, keyAEResult, &resultDesc);
AEDisposeDesc(&resultDesc);
return err;
}
开发者ID:tkurita,项目名称:AEUtils,代码行数:12,代码来源:AEUtils.c
示例15: AEDescCreateWithCFURL
OSErr AEDescCreateWithCFURL(CFURLRef url, AEDesc* outDescPtr)
{
OSStatus err;
CFDataRef data = CFURLCreateData(kCFAllocatorDefault, url, kCFStringEncodingUTF8, true);
if (data != NULL) {
err = AECreateDesc('furl', CFDataGetBytePtr(data),
CFDataGetLength(data), outDescPtr);
CFRelease(data);
} else {
err = kCFURLErrorUnknown;
}
return err;
}
开发者ID:tkurita,项目名称:AEUtils,代码行数:13,代码来源:AEUtils.c
示例16: launch_app
/* -----------------------------------------------------------------------------
use launch services to launch an application
return < 0 if the application cannot be launched
----------------------------------------------------------------------------- */
static int launch_app(char *app, char *params)
{
#ifdef HAVE_LAUNCHSERVICES
CFURLRef urlref;
LSLaunchURLSpec urlspec;
OSStatus err;
#if 0
OSErr oserr;
AEDesc desc;
#endif
urlref = CFURLCreateFromFileSystemRepresentation(NULL, (u_char*)app, strlen(app), FALSE);
if (urlref == 0)
return -1;
#if 0
oserr = AECreateDesc(typeChar, params, strlen(params), &desc);
if (oserr != noErr) {
CFRelease(urlref);
return -1;
}
#endif
urlspec.appURL = urlref;
urlspec.itemURLs = 0;
urlspec.passThruParams = 0;
#if 0
urlspec.passThruParams = &desc;
#endif
urlspec.launchFlags = kLSLaunchAsync + kLSLaunchDontAddToRecents
+ kLSLaunchNewInstance + kLSLaunchNoParams;
urlspec.asyncRefCon = 0;
err = LSOpenFromURLSpec(&urlspec, NULL);
if (err != 0) {
#if 0
AEDisposeDesc(&desc);
#endif
CFRelease(urlref);
return -2;
}
#if 0
AEDisposeDesc(&desc);
#endif
CFRelease(urlref);
#endif /* HAVE_LAUNCHSERVICES */
return 0;
}
开发者ID:Deanzou,项目名称:ppp,代码行数:55,代码来源:main.c
示例17: GetSendersAddress
OSErr GetSendersAddress(AppleEvent *event,AEAddressDesc *targ)
{
Size len=sizeof(long);
DescType actualType;
long sessionID;
OSErr err;
err=AEGetAttributePtr(event, keyAddressAttr, typeSessionID, &actualType, &sessionID, len, &len);
if (err)
return err;
// Create the address desriptor
return AECreateDesc(typeSessionID,(Ptr)&sessionID,sizeof(long), targ);
}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:14,代码来源:AppleEvents.cpp
示例18: MoreAEOCreateAliasDesc
/********************************************************************************
Create and return an AEDesc of type typeAlias using the provided
alias record.
pAliasHdl input: Handle to an alias record.
pAliasAEDesc input: Pointer to null AEDesc.
output: an AEDesc of type typeAlias.
RESULT CODES
____________
noErr 0 No error
memFullErr -108 Not enough room in heap zone
*/
pascal OSErr MoreAEOCreateAliasDesc( const AliasHandle pAliasHdl,
AEDesc *pAliasAEDesc )
{
OSErr anErr = noErr;
char handleState = HGetState( (Handle)pAliasHdl );
HLock( (Handle)pAliasHdl );
anErr = AECreateDesc( typeAlias, *pAliasHdl, GetHandleSize( (Handle)pAliasHdl ), pAliasAEDesc );
HSetState( (Handle)pAliasHdl, handleState );
return anErr;
}//end MoreAEOCreateAliasDesc
开发者ID:paullalonde,项目名称:B,代码行数:27,代码来源:MoreAEObjects.c
示例19: LSFindApplicationForInfo
void
Moose::launchAudioscrobbler( const std::vector<std::string>& vargs )
{
FSRef appRef;
LSFindApplicationForInfo( kLSUnknownCreator, CFSTR( AUDIOSCROBBLER_BUNDLEID ), NULL, &appRef, NULL );
const void* arg[vargs.size()];
int index(0);
AEDescList argAEList;
AECreateList( NULL, 0, FALSE, &argAEList );
for( std::vector<std::string>::const_iterator i = vargs.begin(); i != vargs.end(); i++ ) {
arg[index++] = CFStringCreateWithCString( NULL, i->c_str(), kCFStringEncodingUTF8 );
AEPutPtr( &argAEList, 0, typeChar, i->c_str(), i->length());
}
LSApplicationParameters params;
params.version = 0;
params.flags = kLSLaunchAndHide | kLSLaunchDontSwitch | kLSLaunchAsync;;
params.application = &appRef;
params.asyncLaunchRefCon = NULL;
params.environment = NULL;
CFArrayRef args = CFArrayCreate( NULL, ((const void**)arg), vargs.size(), NULL);
params.argv = args;
AEAddressDesc target;
AECreateDesc( typeApplicationBundleID, CFSTR( AUDIOSCROBBLER_BUNDLEID ), 16, &target);
AppleEvent event;
AECreateAppleEvent ( kCoreEventClass,
kAEReopenApplication ,
&target,
kAutoGenerateReturnID,
kAnyTransactionID,
&event );
AEPutParamDesc( &event, keyAEPropData, &argAEList );
params.initialEvent = &event;
LSOpenApplication( ¶ms, NULL );
AEDisposeDesc( &argAEList );
AEDisposeDesc( &target );
}
开发者ID:Erkan-Yilmaz,项目名称:lastfm-desktop,代码行数:48,代码来源:Moose_mac.cpp
示例20: putBoolToReply
OSErr putBoolToReply(Boolean aBool, AppleEvent *reply)
{
#if useLog
printf("start putBoolToReply\n");
#endif
OSErr err;
DescType resultType = (aBool? typeTrue:typeFalse);
AEDesc resultDesc;
AECreateDesc(resultType, NULL, 0, &resultDesc);
err=AEPutParamDesc(reply, keyAEResult, &resultDesc);
AEDisposeDesc(&resultDesc);
#if useLog
printf("end putBoolToReply\n");
#endif
return err;
}
开发者ID:tkurita,项目名称:AEUtils,代码行数:16,代码来源:AEUtils.c
注:本文中的AECreateDesc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论