当前位置: 首页>>代码示例>>C++>>正文


C++ AEDisposeDesc函数代码示例

本文整理汇总了C++中AEDisposeDesc函数的典型用法代码示例。如果您正苦于以下问题:C++ AEDisposeDesc函数的具体用法?C++ AEDisposeDesc怎么用?C++ AEDisposeDesc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了AEDisposeDesc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AELoadCart

short 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,代码来源:GB_AE.c

示例2: AECoerceDesc

Boolean 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,代码来源:nsAECompare.cpp

示例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: ODDisposeAppleEvent

OSErr 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,代码来源:SEUtils.cpp

示例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: __rbosa_raise_potential_app_error

static 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,代码来源:rbosa.c

示例7: 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

示例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,代码来源:TAEHelpers.c

示例9: PyList_New

static 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,代码来源:ae.c

示例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,代码来源:main.c

示例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,代码来源:TAEHelpers.c

示例12: 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( &params, NULL );
    AEDisposeDesc( &argAEList );
    AEDisposeDesc( &target );
}
开发者ID:Erkan-Yilmaz,项目名称:lastfm-desktop,代码行数:48,代码来源:Moose_mac.cpp

示例13: OpenDocumentsAE

static 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,代码来源:startui.c

示例14: 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

示例15: nav_file_filter

Boolean 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,代码来源:nav_serve.c


注:本文中的AEDisposeDesc函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。