这篇教程C++ AEDisposeDesc函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AEDisposeDesc函数的典型用法代码示例。如果您正苦于以下问题:C++ AEDisposeDesc函数的具体用法?C++ AEDisposeDesc怎么用?C++ AEDisposeDesc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AEDisposeDesc函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: AELoadCartshort AELoadCart(AppleEvent* aev, AppleEvent* reply, long refCon){short err;FSSpec cart;AEDescList docList;AEKeyword keyWd;DescType typ;long items,siz; err = AEGetParamDesc(aev,keyDirectObject,typeAEList,&docList); if(err==0) { err = AECountItems(&docList,&items); for(short i=1;i<=items;i++) { err = AEGetNthPtr(&docList,i,typeFSS,&keyWd,&typ,(Ptr)&cart,sizeof(FSSpec),&siz); if(err==0) { if(CheckFileType(&cart,'Cart')) { LoadCartridgeFile(&cart); AEDisposeDesc(&docList); return 0; } } } AEDisposeDesc(&docList); } return err;}
开发者ID:zenmumbler,项目名称:GrayBox,代码行数:27,
示例2: AECoerceDescBoolean AEComparisons::CompareEnumeration(DescType oper, const AEDesc *desc1, const AEDesc *desc2){ OSErr err = noErr; Boolean result = false; long lhs; long rhs; StAEDesc charDesc; // Make each number is a long integer (in case it's a short integer or other integer type) // before extracting the data */ err = AECoerceDesc(desc1, typeChar, &charDesc); ThrowIfOSErr(err); lhs = **(long **)(charDesc.dataHandle); AEDisposeDesc(&charDesc); err = AECoerceDesc(desc2, typeChar, &charDesc); ThrowIfOSErr(err); rhs = **(long **)charDesc.dataHandle; AEDisposeDesc(&charDesc); switch (oper) { case kAEEquals: result = (lhs == rhs); // equality is the only test that makes sense for enumerators break; default: ThrowOSErr(errAEBadTestKey); } return result;}
开发者ID:fortunto2,项目名称:celtx,代码行数:35,
示例3: SendAppleEventToSystemProcessOSStatus 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,
示例4: ODDisposeAppleEventOSErr ODDisposeAppleEvent( AppleEvent* aevt ){#if !defined(_PLATFORM_WIN32_) || !defined(PORTING_HACK) (void)AEDisposeDesc( aevt ); return AEDisposeDesc( aevt );#else // defined(_PLATFORM_WIN32_) && defined(PORTING_HACK) return 0;#endif // !defined(_PLATFORM_WIN32_) || !defined(PORTING_HACK)}
开发者ID:OS2World,项目名称:DEV-SAMPLES-IBM_OpenDoc,代码行数:9,
示例5: BigSendAppleEventOSErr 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,
示例6: __rbosa_raise_potential_app_errorstatic void__rbosa_raise_potential_app_error (AEDesc *reply){ OSErr error; AEDesc errorNumDesc; AEDesc errorStringDesc; int errorNum; const char * errorMsg; char exception[128]; if (AEGetParamDesc (reply, keyErrorNumber, typeSInt32, &errorNumDesc) != noErr) return; if (AEGetDescData (&errorNumDesc, &errorNum, sizeof errorNum) != noErr) { AEDisposeDesc (&errorNumDesc); return; } if (errorNum == noErr) return; /* The reply is an application error. */ errorMsg = error_code_to_string(errorNum); if (errorMsg == NULL) errorMsg = "Unknown error"; exception[0] = '/0'; error = AEGetParamDesc (reply, keyErrorString, typeChar, &errorStringDesc); if (error == noErr) { Size size; size = AEGetDescDataSize (&errorStringDesc); if (size > 0) { char *msg; msg = (char *)malloc (size + 1); if (msg != NULL) { if (AEGetDescData (&errorStringDesc, msg, size) == noErr) { msg[size] = '/0'; snprintf (exception, sizeof exception, "application returned error: %s (%d), with message: %s", errorMsg, errorNum, msg); } free (msg); } } AEDisposeDesc (&errorStringDesc); } if (exception[0] == '/0') snprintf (exception, sizeof exception, "application returned error: %s (%d)", errorMsg, errorNum); AEDisposeDesc (&errorNumDesc); rb_raise (rb_eRuntimeError, exception);}
开发者ID:bmorton,项目名称:rubyosa,代码行数:55,
示例7: SendOpenAEOSStatus 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,
示例8: 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,
示例9: PyList_Newstatic PyObject *BuildTerminologyList(AEDesc *theDesc, DescType requiredType) { AEDesc item; long size, i; AEKeyword key; PyObject *itemObj, *result; OSErr err; result = PyList_New(0); if (!result) return NULL; if (theDesc->descriptorType == typeAEList) { err = AECountItems(theDesc, &size); if (err) { Py_DECREF(result); return AE_MacOSError(err); } for (i = 1; i <= size; i++) { err = AEGetNthDesc(theDesc, i, requiredType, &key, &item); if (!err) { itemObj = AE_AEDesc_New(&item); if (!itemObj) { AEDisposeDesc(&item); Py_DECREF(result); return NULL; } err = PyList_Append(result, itemObj); if (err) { Py_DECREF(itemObj); Py_DECREF(result); return NULL; } } else if (err != errAECoercionFail) { Py_DECREF(result); return AE_MacOSError(err); } } } else { itemObj = AE_AEDesc_New(theDesc); if (!itemObj) { AEDisposeDesc(theDesc); Py_DECREF(result); return NULL; } err = PyList_Append(result, itemObj); if (err) { Py_DECREF(itemObj); Py_DECREF(result); return NULL; } } return result;}
开发者ID:AdminCNP,项目名称:appscript,代码行数:51,
示例10: 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,
示例11: ResendLastTabletEventofType// ResendLastTabletEventofType//// This function will instruct the Tablet Driver to resend either the last// posted proximity event, or pointer event.//// parameters: DescType tabletEventType - eEventProximity, eEventPointer//// returns: noErr on success, else an AE error code//////////////////////////////////////////////////////////////////////////////OSErr ResendLastTabletEventofType(DescType tabletEventType){ AEDesc driverTarget; AppleEvent aeSend; OSErr err; err = GetTabletDriverTarget(&driverTarget); if(err) { AEDisposeDesc(&driverTarget); return err; } err = AECreateAppleEvent(kAEWacomSuite, // Create a special Wacom Event eSendTabletEvent, // Send Last Tablet Event &driverTarget, kAutoGenerateReturnID, kAnyTransactionID, &aeSend); if(err) { AEDisposeDesc(&driverTarget); return err; } err = AEPutParamPtr ( &aeSend, keyAEData, typeEnumeration, &tabletEventType, sizeof(tabletEventType)); // Add what type of event to send if(err) { AEDisposeDesc(&driverTarget); return err; } // Finally send the event err = AESend(&aeSend, // The complete AE we created above NULL, kAEWaitReply, kAEHighPriority, kDefaultTimeOut, NULL, NULL); AEDisposeDesc(&aeSend);
开发者ID:CNMAT,项目名称:CNMAT-Externs,代码行数:54,
示例12: LSFindApplicationForInfovoid 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,
示例13: OpenDocumentsAEstatic pascal OSErr OpenDocumentsAE( const AppleEvent * theAppleEvent, AppleEvent * reply, SInt32 handlerRefcon) { AEDescList docList; FSRef theFSRef; long index; long count = 0; OSErr err; char buffer[2048]; fprintf( logfile, "OPEN event received./n" ); fflush( logfile ); if ( localsplash ) start_splash_screen(); err = AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList); err = AECountItems(&docList, &count); for(index = 1; index <= count; index++) { err = AEGetNthPtr(&docList, index, typeFSRef, NULL, NULL, &theFSRef, sizeof(theFSRef), NULL);// 4 err = FSRefMakePath(&theFSRef,(unsigned char *) buffer,sizeof(buffer)); ViewPostScriptFont(buffer,0); fprintf( logfile, " file: %s/n", buffer ); } system( "DYLD_LIBRARY_PATH=/"/"; osascript -e 'tell application /"X11/" to activate'" ); AEDisposeDesc(&docList); fprintf( logfile, " event processed %d./n", err ); fflush( logfile );return( err );}
开发者ID:MichinariNukazawa,项目名称:fontforge,代码行数:30,
示例14: IACnewsystemverbBoolean 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,
示例15: nav_file_filterBoolean nav_file_filter(AEDesc *theItem,void *info,void *callBackUD,NavFilterModes filterMode){ char *c,filename[256]; NavFileOrFolderInfo *filefolder; AEDesc desc; HFSUniStr255 uniname; CFStringRef cfstr; FSRef fref; if ((theItem->descriptorType!=typeFSS) && (theItem->descriptorType!=typeFSRef)) return(FALSE); filefolder=(NavFileOrFolderInfo*)info; if (filefolder->isFolder) return(TRUE); AECoerceDesc(theItem,typeFSRef,&desc); AEGetDescData(&desc,(void*)&fref,sizeof(FSRef)); AEDisposeDesc(&desc); FSGetCatalogInfo(&fref,kFSCatInfoNone,NULL,&uniname,NULL,NULL); cfstr=CFStringCreateWithCharacters(kCFAllocatorDefault,uniname.unicode,uniname.length); CFStringGetCString(cfstr,filename,256,kCFStringEncodingMacRoman); CFRelease(cfstr); c=strchr(filename,'.'); if (c==NULL) return(FALSE); return(strcasecmp((c+1),nav_filetype)==0);}
开发者ID:prophile,项目名称:dim3,代码行数:28,
示例16: getFSRefFromUTextAEOSStatus getFSRefFromUTextAE(const AppleEvent *ev, AEKeyword theKey, FSRef *ref_p){ AEDesc givenDesc; OSStatus err = AEGetParamDesc(ev, theKey, typeUnicodeText, &givenDesc);#if useLog showAEDesc(&givenDesc);#endif if (err != noErr) goto bail; CFURLRef urlRef = NULL; err = getURLFromUTextDesc(&givenDesc, &urlRef); if (err != noErr) goto bail; Boolean canGetFSRef = 0; if (urlRef != NULL) { canGetFSRef = CFURLGetFSRef(urlRef, ref_p); } if (! canGetFSRef) { err = errAECoercionFail; }bail: AEDisposeDesc(&givenDesc); safeRelease(urlRef); return err;}
开发者ID:tkurita,项目名称:AEUtils,代码行数:27,
示例17: AEDisposeDescQstatic void AEDisposeDescQ(AEDesc *descPtr){ OSStatus junk; junk = AEDisposeDesc(descPtr); assert(junk == noErr); *descPtr = kAENull;}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:8,
示例18: we_are_deadstatic void we_are_dead(void) { AttachErrorCode(quit_event,noErr); /* Send the reply (I hope) */ AESendMessage(quit_event,NULL, kAENoReply, kAEDefaultTimeout); AEDisposeDesc(quit_event); /* fall off the end of the world and die */ fprintf( logfile, " event succeded./n"); fflush( logfile );}
开发者ID:MichinariNukazawa,项目名称:fontforge,代码行数:8,
示例19: SendAppleEventToSystemProcessOSStatus SendAppleEventToSystemProcess(AEEventID EventToSend){ AEAddressDesc targetDesc; static const ProcessSerialNumber kPSNOfSystemProcess = { 0, kSystemProcess }; AppleEvent eventReply = {typeNull, NULL}; AppleEvent appleEventToSend = {typeNull, NULL}; OSStatus error = noErr; error = AECreateDesc(typeProcessSerialNumber, &kPSNOfSystemProcess, sizeof(kPSNOfSystemProcess), &targetDesc); if (error != noErr) { return(error); } error = AECreateAppleEvent(kCoreEventClass, EventToSend, &targetDesc, kAutoGenerateReturnID, kAnyTransactionID, &appleEventToSend); AEDisposeDesc(&targetDesc); if (error != noErr) { return(error); } error = AESend(&appleEventToSend, &eventReply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, NULL, NULL); AEDisposeDesc(&appleEventToSend); if (error != noErr) { return(error); } AEDisposeDesc(&eventReply); return(error); //if this is noErr then we are successful}
开发者ID:jfro,项目名称:QuickBoot,代码行数:45,
示例20: manually_locate_productstatic int manually_locate_product(const char *name, char *buf, size_t bufsize, const char *title){ NavDialogCreationOptions dlgopt; NavDialogRef dlg; NavReplyRecord reply; NavUserAction action; AEKeyword keyword; AEDesc desc; FSRef fsref; OSStatus rc; int retval = 0; const char *promptfmt = _("We can't find your /"%s/" installation." " Would you like to show us where it is?"); char *promptstr = alloca(strlen(name) + strlen(promptfmt) + 1); if (promptstr == NULL) { log_fatal(_("Out of memory.")); return(0); } /* if */ sprintf(promptstr, promptfmt, name); if (!ui_prompt_yn(promptstr, title)) return(0); NavGetDefaultDialogCreationOptions(&dlgopt); dlgopt.optionFlags |= kNavSupportPackages; dlgopt.optionFlags |= kNavAllowOpenPackages; dlgopt.optionFlags &= ~kNavAllowMultipleFiles; dlgopt.windowTitle = CFSTR("Please select the product's icon and click 'OK'."); /* !!! FIXME! */ dlgopt.actionButtonLabel = CFSTR("OK"); NavCreateChooseFolderDialog(&dlgopt, NULL, NULL, NULL, &dlg); NavDialogRun(dlg); action = NavDialogGetUserAction(dlg); if (action != kNavUserActionCancel) { NavDialogGetReply(dlg, &reply); rc = AEGetNthDesc(&reply.selection, 1, typeFSRef, &keyword, &desc); if (rc != noErr) log_fatal("Unexpected error in AEGetNthDesc: %d", (int) rc); else { /* !!! FIXME: Check return values here! */ BlockMoveData(*desc.dataHandle, &fsref, sizeof (fsref)); FSRefMakePath(&fsref, BAD_CAST buf, bufsize - 1); buf[bufsize - 1] = '/0'; AEDisposeDesc(&desc); retval = 1; } /* if */ NavDisposeReply(&reply); } /* else */ NavDialogDispose(dlg); return(retval);} /* manually_locate_product */
开发者ID:megastep,项目名称:loki_setup,代码行数:57,
示例21: IACdrivefilelistOSErr IACdrivefilelist (tyFScallback handlespecroutine) { /* the opendoc and printdoc required events take a list of filespecs as a parameter. we factor out the common code, and make it a little easier for an application to handle these events. you supply a callback routine that handles a single filespec, you could print it or open it, depending on which of the required events is being invoked. */ AEDesc desc; long ctfiles; DescType actualtype; long actualsize; AEKeyword actualkeyword; FSSpec fs; long i; OSErr ec; ec = AEGetKeyDesc (IACglobals.event, keyDirectObject, typeAEList, &desc); IACglobals.errorcode = ec; if (ec != noErr) return (ec); ec = AECountItems (&desc, &ctfiles); IACglobals.errorcode = ec; if (ec != noErr) return (ec); for (i = 1; i <= ctfiles; i ++) { ec = AEGetNthPtr ( &desc, i, typeFSS, &actualkeyword, &actualtype, (Ptr) &fs, sizeof (fs), &actualsize); IACglobals.errorcode = ec; if (ec != noErr) { AEDisposeDesc (&desc); return (ec); } if (!(*handlespecroutine) (&fs)) return (-1); } /*for*/ return (noErr); } /*IACdrivefilelist*/
开发者ID:dvincent,项目名称:frontier,代码行数:57,
示例22: UpdateUserTokenvoid UpdateUserToken(Environment* ev, ODNameResolver* resolver, ODOSLToken* odToken, AEDesc* desc){#if !defined(_PLATFORM_WIN32_) || !defined(PORTING_HACK) ODDesc* userODToken = resolver->GetUserToken(ev, odToken); THROW_IF_ERROR(AEDescToODDesc(desc, userODToken)); THROW_IF_ERROR(AEDisposeDesc(desc));#endif // !defined(_PLATFORM_WIN32_) || !defined(PORTING_HACK)}
开发者ID:OS2World,项目名称:DEV-SAMPLES-IBM_OpenDoc,代码行数:9,
示例23: ForEachFileDo// Extracts all the files from a Finder print or open apple event and call the routine specified// on each of themOSErr ForEachFileDo(const AppleEvent *message,AEFileProc theirProc){ OSErr err = noErr; AEDesc fileListDesc; long numFiles; DescType actualType; long actualSize; AEKeyword actualKeyword; FSSpec oneFile; long index; /* extract the list of aliases into fileListDesc */ err = AEGetKeyDesc(message, keyDirectObject, typeAEList, &fileListDesc); if (err!=noErr) return err; /* count the list elements */ err = AECountItems(&fileListDesc, &numFiles); if (err != noErr) { AEDisposeDesc(&fileListDesc); return err; } /* get each from list and process it */ for (index = 1; index <= numFiles; index ++) { err = AEGetNthPtr(&fileListDesc, index, typeFSS, &actualKeyword, &actualType, (Ptr)&oneFile, sizeof(oneFile), &actualSize); if (err != noErr) { AEDisposeDesc(&fileListDesc); return err; } /* oneFile contains FSSpec of file in question */ err=theirProc(&oneFile); if (err) break; } AEDisposeDesc(&fileListDesc); return err;}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:46,
示例24: putMissingValueToReplyOSErr 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,
示例25: KeynoteChangeSlideOSStatusKeynoteChangeSlide(AEEventID eventID){ OSStatus err = noErr; AppleEvent eventToSend = { typeNull, nil }; AppleEvent eventReply = { typeNull, nil }; AEBuildError eventBuildError; err = AEBuildAppleEvent( keynoteEventClass, // Event class for the resulting event eventID, // Event ID for the resulting event typeApplicationBundleID, keynoteID, strlen(keynoteID), kAutoGenerateReturnID, // Return ID for the created event kAnyTransactionID, // Transaction ID for this event &eventToSend, // Pointer to location for storing result &eventBuildError, // Pointer to error structure "", // AEBuild format string describing the NULL // AppleEvent record to be created ); if (err != noErr) { fprintf(stderr, "Failed to build Apple event (error %d)./n", (int)err); return err; } err = AESend(&eventToSend, &eventReply, kAEWaitReply, // send mode (wait for reply) kAENormalPriority, kNoTimeOut, nil, // no pointer to idle function nil); // no pointer to filter function if (err != noErr) fprintf(stderr, "Failed to send Apple event (error %d)./n", (int)err); // Dispose of the send/reply descs AEDisposeDesc(&eventToSend); AEDisposeDesc(&eventReply); return err;}
开发者ID:Dalboz,项目名称:iremoted,代码行数:43,
示例26: MoreAEDisposeDescpascal void MoreAEDisposeDesc(AEDesc *desc){ OSStatus junk; MoreAssertQ(desc != nil); junk = AEDisposeDesc(desc); MoreAssertQ(junk == noErr); MoreAENullDesc(desc);}
开发者ID:r0ssar00,项目名称:platform,代码行数:10,
示例27: rbosa_element_datastatic VALUErbosa_element_data (int argc, VALUE *argv, VALUE self){ VALUE coerce_type; AEDesc coerced_desc; AEDesc * desc; OSErr error; void * data; Size datasize; VALUE retval; bool to_4cc; rb_scan_args (argc, argv, "01", &coerce_type); to_4cc = false; desc = rbosa_element_aedesc (self); if (!NIL_P (coerce_type)) { FourCharCode code; code = RVAL2FOURCHAR (coerce_type); error = AECoerceDesc (desc, code, &coerced_desc); if (error != noErr) rb_raise (rb_eRuntimeError, "Cannot coerce desc to type %s : %s (%d)", RVAL2CSTR (coerce_type), error_code_to_string (error), error); desc = &coerced_desc; to_4cc = code == 'type'; } datasize = AEGetDescDataSize (desc); data = (void *)malloc (datasize); if (data == NULL) rb_fatal ("cannot allocate memory"); error = AEGetDescData (desc, data, datasize); if (error == noErr) { if (to_4cc) *(DescType*)data = CFSwapInt32HostToBig (*(DescType*)data); retval = rb_str_new (data, datasize); } else { retval = Qnil; } if (!NIL_P (coerce_type)) AEDisposeDesc (&coerced_desc); free (data); if (error != noErr) rb_raise (rb_eRuntimeError, "Cannot get desc data : %s (%d)", error_code_to_string (error), error); return retval; }
开发者ID:bmorton,项目名称:rubyosa,代码行数:55,
示例28: CFMutableArrayCreatePOSIXPathsWithEventCFMutableArrayRef CFMutableArrayCreatePOSIXPathsWithEvent( const AppleEvent *ev, AEKeyword theKey, OSErr *errPtr){ CFMutableArrayRef outArray = NULL; DescType typeCode; Size dataSize; AEDescList aeList = {typeNull, NULL}; *errPtr = AESizeOfParam(ev, theKey, &typeCode, &dataSize); if ((*errPtr != noErr) || (typeCode == typeNull)){ goto bail; } *errPtr = AEGetParamDesc(ev, theKey, typeAEList, &aeList); if (*errPtr != noErr) goto bail; long count = 0; *errPtr = AECountItems(&aeList, &count); if (*errPtr != noErr) goto bail; outArray = CFArrayCreateMutable(NULL, count, &kCFTypeArrayCallBacks); for(long index = 1; index <= count; index++) { void *value_ptr = NULL; Size data_size; *errPtr = AEGetNthPtr(&aeList, index, typeFileURL, NULL, NULL, value_ptr, 0, &data_size); if (*errPtr == noErr) { value_ptr = malloc(data_size); *errPtr = AEGetNthPtr(&aeList, index, typeFileURL, NULL, NULL, value_ptr, data_size, NULL); } if (*errPtr != noErr) { fputs("Fail to AEGetNthPtr in CFMutableArrayCreatePOSIXPathsWithEvent", stderr); goto bail; } CFURLRef file_url = CFURLCreateAbsoluteURLWithBytes( NULL, (const UInt8 *)value_ptr, data_size, kCFStringEncodingUTF8, NULL, false); CFStringRef path = CFURLCopyFileSystemPath(file_url, kCFURLPOSIXPathStyle); CFArrayAppendValue(outArray, path); CFRelease(file_url); CFRelease(path); free(value_ptr); }bail: AEDisposeDesc(&aeList); return outArray;}
开发者ID:tkurita,项目名称:AEUtils,代码行数:55,
示例29: putStringListToEventOSErr putStringListToEvent(AppleEvent *ev, AEKeyword keyword, CFArrayRef array, CFStringEncoding kEncoding){ OSErr err; AEDescList resultList; err = AECreateList(NULL, 0, FALSE, &resultList); for (int n = 0; n < CFArrayGetCount(array); n++) { CFStringRef string = CFArrayGetValueAtIndex(array, n); AEDesc string_desc; err = AEDescCreateWithCFString(string, kEncoding, &string_desc); if (err != noErr) goto bail; err = AEPutDesc(&resultList, n+1, &string_desc); AEDisposeDesc(&string_desc); } err = AEPutParamDesc(ev, keyword, &resultList);bail: AEDisposeDesc(&resultList); return err;}
开发者ID:tkurita,项目名称:AEUtils,代码行数:20,
注:本文中的AEDisposeDesc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AEInstallEventHandler函数代码示例 C++ AECreateDesc函数代码示例 |