• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ AECountItems函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: WXUNUSED

short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply))
{
    AEDescList docList;
    AEKeyword keywd;
    DescType returnedType;
    Size actualSize;
    long itemsInList;
    OSErr err;
    short i;
    err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
    if (err != noErr)
        return err;

    err = AECountItems(&docList, &itemsInList);
    if (err != noErr)
        return err;

    ProcessSerialNumber PSN ;
    PSN.highLongOfPSN = 0 ;
    PSN.lowLongOfPSN = kCurrentProcess ;
    SetFrontProcess( &PSN ) ;

    for (i = 1; i <= itemsInList; i++) {
        wxString fName ;

        FSRef theRef ;
        AEGetNthPtr(&docList, i, typeFSRef, &keywd, &returnedType,
        (Ptr) & theRef, sizeof(theRef), &actualSize);
        fName = wxMacFSRefToPath( &theRef ) ;

        MacPrintFile(fName);
    }
    return noErr;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:34,代码来源:app.cpp


示例2: ChooseFile

AliasHandle	ChooseFile()
{
	NavReplyRecord reply;
	
	OSStatus err = NavChooseFile(NULL, &reply, NULL, NULL, NULL, NULL, NULL, NULL);
	if (err == noErr && reply.validRecord) {
		long count;
		err = AECountItems(&(reply.selection), &count);
		if (err == noErr)
		{
			AEKeyword   theKeyword;
			DescType    actualType;
			Size        actualSize;
			FSSpec		fspec;
				
			// Get a pointer to selected file
			err = AEGetNthPtr(&(reply.selection), 1,
								typeFSS, &theKeyword,
								&actualType, &fspec,
								sizeof(FSSpec),
								&actualSize);
			if (err == noErr) {
				AliasHandle ah;
				RequireNoErrString(NewAlias(NULL, &fspec, &ah), "NewAlias failed");
				return ah;
			}
		}
	}
	return NULL;
}
开发者ID:fruitsamples,项目名称:XFramework,代码行数:30,代码来源:XUtility.cpp


示例3: tokenDesc

/*----------------------------------------------------------------------------
	HandleCount 
	
----------------------------------------------------------------------------*/
void AEGenericClass::HandleCount(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
{
	ConstAETokenDesc	tokenDesc(token);
	long 			numberOfObjects = 0;
	DescType		objectClass;
	OSErr		err = noErr;	

	if (!reply->dataHandle)
		return;
	
	// Get the class of object that we will count
	err = GetObjectClassFromAppleEvent(appleEvent, &objectClass);
	ThrowIfOSErr(err);
	
	err = CheckForUnusedParameters(appleEvent);
	ThrowIfOSErr(err);

	if (AEListUtils::TokenContainsTokenList(token))
	{
		err = AECountItems(token, &numberOfObjects);
		ThrowIfOSErr(err);
		
	}
	else
	{
		CountObjects(objectClass, tokenDesc.GetDispatchClass(), token, &numberOfObjects);
	}

	err = AEPutParamPtr(reply, keyAEResult, 
								 typeLongInteger, 
								 (Ptr)&numberOfObjects, 
								 sizeof(long));
	ThrowIfOSErr(err);
}
开发者ID:fortunto2,项目名称:celtx,代码行数:38,代码来源:nsAEGenericClass.cpp


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


示例5: AEOpenFiles

pascal OSErr AEOpenFiles(AppleEvent *theAppleEvent, AppleEvent *theReply,
                         long Refcon)
{
    AEDescList docList;
    AEKeyword keywd;
    DescType returnedType;
    Size actualSize;
    long itemsInList;
    FSSpec theSpec;
    CInfoPBRec pb;
    Str255 name;
    short i;
    
    if (AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList) !=
        noErr) return;
    if (AECountItems (&docList, &itemsInList) != noErr) return;
    
    SetSelection (TEXTREC->teLength, TEXTREC->teLength);
    for (i = 1; i <= itemsInList; i++) {
        AEGetNthPtr (&docList, i, typeFSS, &keywd, &returnedType, 
            (Ptr) &theSpec, sizeof(theSpec), &actualSize);
        
        GetFullPath(&theSpec, name);
        P2CStr(name); // was: pstrterm(name);
        if (xlload ((char *)name + 1, 1, 0) == 0) xlabort ("load error");
    }
    macputs ("> ");
    PrepareForInput ();
}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:29,代码来源:MacAE.c


示例6: OpenDocuments

static	OSStatus	OpenDocuments( AEDescList docList )
{
	long				index;
	FSRef				fsRef;
	long				count			= 0;
	OSStatus			status			= AECountItems( &docList, &count );
	require_noerr( status, CantGetCount );

	for( index = 1; index <= count; index++ )
	{
		if ( (status = AEGetNthPtr( &docList, index, typeFSRef, NULL, NULL, &fsRef, sizeof(FSRef), NULL) ) == noErr )
		{
				/* convert the FSRef into a Core Foundation URL */
			CFURLRef parentURLRef = CFURLCreateFromFSRef(NULL, &fsRef);
			if (NULL != parentURLRef)
			{
				GetMovieFromCFURLRef(&parentURLRef, &mCurrentMovie);
			}
		}
	}
	
CantGetName:
CantCreateWindow:
CantGetCount:
	return( status );
}
开发者ID:fruitsamples,项目名称:SimpleAudioExtraction,代码行数:26,代码来源:main.c


示例7: OpenFiles

void	OpenFiles()
{
	NavReplyRecord		reply;
	OSErr				err;
	long				i, n;
	FSSpec				spec;
	AEKeyword			keyWd;
	DescType			typeCd;
	Size				actSz;
	NavDialogOptions	navDialogOptions;
	
	NavGetDefaultDialogOptions( &navDialogOptions );
	navDialogOptions.dialogOptionFlags	|= ( kNavDontResolveAliases + kNavSupportPackages );
	
	err	= NavChooseFile( NULL, &reply, &navDialogOptions, NULL, NULL, NULL, NULL, NULL );
	if ( err != noErr )	goto Bail;
	if ( !reply.validRecord ) { err = userCanceledErr; goto Bail; }

	err = AECountItems( &reply.selection, &n );
	if ( err != noErr )	goto Bail;

	for ( i = 1 ; i <= n; i++ )
	{
		err = AEGetNthPtr( &reply.selection, i, typeFSS, &keyWd, &typeCd, (Ptr) &spec, sizeof(spec), (actSz = sizeof(spec), &actSz) );
		if ( err != noErr ) goto Bail;
		
		//XXX	Do Something with spec
		SysBeep( 0 );
	}

Bail:
	return;
}
开发者ID:fruitsamples,项目名称:WindowFun,代码行数:33,代码来源:WindowFun.c


示例8: AECountItems

/*----------------------------------------------------------------------------
	GetDataFromList 

	
----------------------------------------------------------------------------*/
void AEGenericClass::GetDataFromList(const AEDesc *srcList, AEDesc *desiredTypes, AEDesc *dstList)
{
	OSErr		err;
	long			itemNum;
	long			numItems;
	DescType		keyword;
	StAEDesc		srcItem;
	StAEDesc		dstItem;
		
	err = AECountItems((AEDescList*)srcList, &numItems);
	ThrowIfOSErr(err);
		
	for (itemNum = 1; itemNum <= numItems; itemNum++)
	{
		err = AEGetNthDesc(srcList, itemNum, typeWildCard, &keyword, &srcItem);
		ThrowIfOSErr(err);
		
		if (AEListUtils::TokenContainsTokenList(&srcItem) == false)
		{
			GetDataFromObject(&srcItem, desiredTypes, &dstItem);  // Get data from single item
		}
		else
		{
			ThrowIfOSErr(AECreateList(nil, 0, false, &dstItem));
			GetDataFromList(&srcItem, desiredTypes, &dstItem);
		}
		err = AEPutDesc(dstList, itemNum, &dstItem);
		ThrowIfOSErr(err);
	}
}
开发者ID:fortunto2,项目名称:celtx,代码行数:35,代码来源:nsAEGenericClass.cpp


示例9: SetDataForObject

/*----------------------------------------------------------------------------
	SetDataForList 

	Given a token that contains a list of cWindow tokens,
	walk the list recursively to set the data for each token in the list
	
----------------------------------------------------------------------------*/
void AEGenericClass::SetDataForList(const AEDesc *token, AEDesc *data)
{
	OSErr 			err;
		
	if (AEListUtils::TokenContainsTokenList(token) == false)
	{
		SetDataForObject(token, data);
	}
	else
	{
		long			numItems;
		long			itemNum;
		err = AECountItems((AEDescList*)token, &numItems);
		ThrowIfOSErr(err);
		
		for (itemNum = 1; itemNum <= numItems; itemNum++)
		{
			StAEDesc	  	tempToken;
			AEKeyword	keyword;
			
		 	err = AEGetNthDesc((AEDescList*)token, itemNum, typeWildCard, &keyword, &tempToken);
			ThrowIfOSErr(err);
			
			if (AEListUtils::TokenContainsTokenList(&tempToken) == false)
			{
				SetDataForObject(&tempToken, data);  		// Set data from single item
			}
			else
			{
				SetDataForList(&tempToken, data); 	// Recurse sublist
			}
		}
	}
}
开发者ID:fortunto2,项目名称:celtx,代码行数:41,代码来源:nsAEGenericClass.cpp


示例10: memset

OSStatus	LLFilePicker::doNavChooseDialog(ELoadFilter filter)
{
	OSStatus		error = noErr;
	NavDialogRef	navRef = NULL;
	NavReplyRecord	navReply;

	// if local file browsing is turned off, return without opening dialog
	if ( check_local_file_access_enabled() == false )
	{
		return FALSE;
	}

	memset(&navReply, 0, sizeof(navReply));
	
	// NOTE: we are passing the address of a local variable here.  
	//   This is fine, because the object this call creates will exist for less than the lifetime of this function.
	//   (It is destroyed by NavDialogDispose() below.)
	error = NavCreateChooseFileDialog(&mNavOptions, NULL, NULL, NULL, navOpenFilterProc, (void*)(&filter), &navRef);

	gViewerWindow->getWindow()->beforeDialog();

	if (error == noErr)
		error = NavDialogRun(navRef);

	gViewerWindow->getWindow()->afterDialog();

	if (error == noErr)
		error = NavDialogGetReply(navRef, &navReply);

	if (navRef)
		NavDialogDispose(navRef);

	if (error == noErr && navReply.validRecord)
	{
		SInt32	count = 0;
		SInt32	index;
		
		// AE indexes are 1 based...
		error = AECountItems(&navReply.selection, &count);
		for (index = 1; index <= count; index++)
		{
			FSRef		fsRef;
			AEKeyword	theAEKeyword;
			DescType	typeCode;
			Size		actualSize = 0;
			char		path[MAX_PATH];	/*Flawfinder: ignore*/
			
			memset(&fsRef, 0, sizeof(fsRef));
			error = AEGetNthPtr(&navReply.selection, index, typeFSRef, &theAEKeyword, &typeCode, &fsRef, sizeof(fsRef), &actualSize);
			
			if (error == noErr)
				error = FSRefMakePath(&fsRef, (UInt8*) path, sizeof(path));
			
			if (error == noErr)
				mFiles.push_back(std::string(path));
		}
	}
	
	return error;
}
开发者ID:JohnMcCaffery,项目名称:Armadillo-Phoenix,代码行数:60,代码来源:llfilepicker.cpp


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


示例12: ExtractSingleItem

/* This function extracts a single FSRef from a NavReplyRecord. */
static OSErr ExtractSingleItem(const NavReplyRecord *reply, FSRef *item)
{
    FSSpec fss;
    SInt32 itemCount;
    DescType junkType;
    AEKeyword junkKeyword;
    Size junkSize;
    OSErr osErr;

    osErr = AECountItems(&reply->selection, &itemCount);
    if( itemCount != 1 )	/* we only work with one object at a time */
        osErr = paramErr;
    if( osErr == noErr )
        osErr = AEGetNthPtr(&reply->selection, 1, typeFSS, &junkKeyword, &junkType, &fss, sizeof(fss), &junkSize);
    if( osErr == noErr )
    {
        mycheck(junkType == typeFSS);
        mycheck(junkSize == sizeof(FSSpec));

        /* We call FSMakeFSSpec because sometimes Nav is braindead		*/
        /* and gives us an invalid FSSpec (where the name is empty).	*/
        /* While FSpMakeFSRef seems to handle that (and the file system	*/
        /* engineers assure me that that will keep working (at least	*/
        /* on traditional Mac OS) because of the potential for breaking	*/
        /* existing applications), I'm still wary of doing this so		*/
        /* I regularise the FSSpec by feeding it through FSMakeFSSpec.	*/

        if( fss.name[0] == 0 )
            osErr = FSMakeFSSpec(fss.vRefNum, fss.parID, fss.name, &fss);
        if( osErr == noErr )
            osErr = FSpMakeFSRef(&fss, item);
    }

    return osErr;
}
开发者ID:fruitsamples,项目名称:FSCopyObject,代码行数:36,代码来源:HelloWorld.c


示例13: IACdrivefilelist

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


示例14: CFMutableArrayCreatePOSIXPathsWithEvent

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


示例15: gui_unique_mac_open_documents

/* Handle the kAEOpenDocuments Apple events. This will register
 * an idle source callback for each filename in the event.
 */
static pascal OSErr
gui_unique_mac_open_documents (const AppleEvent *inAppleEvent,
                               AppleEvent       *outAppleEvent,
                               long              handlerRefcon)
{
  OSStatus    status;
  AEDescList  documents;
  gchar       path[MAXPATHLEN];

  status = AEGetParamDesc (inAppleEvent,
                           keyDirectObject, typeAEList,
                           &documents);
  if (status == noErr)
    {
      long count = 0;
      int  i;

      AECountItems (&documents, &count);

      for (i = 0; i < count; i++)
        {
          FSRef    ref;
          gchar    *callback_path;
          GSource  *source;
          GClosure *closure;

          status = AEGetNthPtr (&documents, i + 1, typeFSRef,
                                0, 0, &ref, sizeof (ref),
                                0);
          if (status != noErr)
            continue;

          FSRefMakePath (&ref, (UInt8 *) path, MAXPATHLEN);

          callback_path = g_strdup (path);

          closure = g_cclosure_new (G_CALLBACK (gui_unique_mac_idle_open),
                                    (gpointer) callback_path,
                                    (GClosureNotify) g_free);

          g_object_watch_closure (G_OBJECT (unique_gimp), closure);

          source = g_idle_source_new ();
          g_source_set_priority (source, G_PRIORITY_LOW);
          g_source_set_closure (source, closure);
          g_source_attach (source, NULL);
          g_source_unref (source);
        }
    }

    return status;
}
开发者ID:AnonPower,项目名称:picman,代码行数:55,代码来源:gui-unique.c


示例16: __rbosa_elementlist_count

static long
__rbosa_elementlist_count (AEDescList *list)
{
    OSErr   error;
    long    count;

    error = AECountItems (list, &count);
    if (error != noErr)
        rb_raise (rb_eRuntimeError, "Cannot count items : %s (%d)", 
                  error_code_to_string (error), error);

    return count;
}
开发者ID:bmorton,项目名称:rubyosa,代码行数:13,代码来源:rbosa.c


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


示例18: AEOpenFiles

pascal OSErr AEOpenFiles(const AppleEvent * theAppleEvent,
                         AppleEvent * theReply, long Refcon)
{
    AEDescList docList;
    AEKeyword keywd;
    DescType returnedType;
    Size actualSize;
    long itemsInList;
    FSSpec theSpec;
    CInfoPBRec pb;
    Handle nameh;
    short namelen;
    OSErr err;
    short i;

    err =
        AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList,
                       &docList);
    if (err != noErr)
        return err;

    err = AECountItems(&docList, &itemsInList);
    if (err != noErr)
        return err;

    for (i = 1; i <= itemsInList; i++) {
        AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
                    (Ptr) & theSpec, sizeof(theSpec), &actualSize);

        if (noErr == FSpGetFullPath(&theSpec, &namelen, &nameh)) {
            HLock(nameh);
            char *str = new char[namelen + 1];
            memcpy(str, (char *) *nameh, namelen);
            str[namelen] = 0;
            HUnlock(nameh);
            DisposeHandle(nameh);

            AudacityProject *project = GetActiveProject();

            if (project == NULL || !project->GetTracks()->IsEmpty()) {
                project = CreateNewAudacityProject(gParentWindow);
            }
            project->OpenFile(str);

            delete[]str;
        }
    }

    return noErr;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:50,代码来源:AudacityApp.cpp


示例19: AECountItems

static PyObject *AEDesc_AECountItems(AEDescObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	long theCount;

	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = AECountItems(&_self->ob_itself,
	                    &theCount);
	if (_err != noErr) return AE_MacOSError(_err);
	_res = Py_BuildValue("l",
	                     theCount);
	return _res;
}
开发者ID:AdminCNP,项目名称:appscript,代码行数:15,代码来源:ae.c


示例20: QTApp_HandleOpenDocumentAppleEvent

PASCAL_RTN OSErr QTApp_HandleOpenDocumentAppleEvent (const AppleEvent *theMessage, AppleEvent *theReply, long theRefcon)			
{
#pragma unused(theReply, theRefcon)

	long			myIndex;
	long			myItemsInList;
	AEKeyword		myKeyWd;
	AEDescList 	 	myDocList;
	long			myActualSize;
	DescType		myTypeCode;
	FSSpec			myFSSpec;
	OSErr			myIgnoreErr = noErr;
	OSErr			myErr = noErr;
	
	// get the direct parameter and put it into myDocList
	myDocList.dataHandle = NULL;
	myErr = AEGetParamDesc(theMessage, keyDirectObject, typeAEList, &myDocList);
	
	// count the descriptor records in the list
	if (myErr == noErr)
		myErr = AECountItems(&myDocList, &myItemsInList);
	else
		myItemsInList = 0;
	
	// open each specified file
	for (myIndex = 1; myIndex <= myItemsInList; myIndex++)
		if (myErr == noErr) {
			myErr = AEGetNthPtr(&myDocList, myIndex, typeFSS, &myKeyWd, &myTypeCode, (Ptr)&myFSSpec, sizeof(myFSSpec), &myActualSize);
			if (myErr == noErr) {
				FInfo		myFinderInfo;
			
				// verify that the file type is MovieFileType; to do this, get the Finder information
				myErr = FSpGetFInfo(&myFSSpec, &myFinderInfo);	
				if (myErr == noErr) {
					if (myFinderInfo.fdType == MovieFileType)
						// we've got a movie file; just open it
						QTFrame_OpenMovieInWindow(NULL, &myFSSpec);
				}
			}
		}

	if (myDocList.dataHandle)
		myIgnoreErr = AEDisposeDesc(&myDocList);
	
	// make sure we open the document in the foreground		
	gAppInForeground = true;
	return(myErr);
}
开发者ID:fruitsamples,项目名称:qtgraphics.win,代码行数:48,代码来源:ComApplication.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AECreateDesc函数代码示例发布时间:2022-05-30
下一篇:
C++ ADVANCE_DMA函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap