FW: IMgaFilter

GME GME
Tue Apr 29 19:33:15 CDT 2003



----------
From: 	Kumar Gaurav Chhokra
Sent: 	Tuesday, April 29, 2003 1:33:14 PM
To: 	GME Group
Subject: 	RE: IMgaFilter
Auto forwarded by a Rule

Hi all,

Here's my experience with IMgaFilter: 

Do look at the following code for a better understanding. You can cut&paste this code directly in your raw com interpreter and it should work. Assumptions : 'project' is a (IMgaProject) pointer to the current project. 
The way that works for me is to search for stuff with kind name. set bstrKind to the kind of the required FCO. 

Hope this helps!

Cheers,
Kumar

			///////begin code insertion///////
{

			CComPtr<IMgaFilter> pFilter; // = new IMgaFilter;
			
			project->CreateFilter(&pFilter);
			ASSERT(pFilter);

			//CComBSTR bstrKind = "AsyncPrimitive"; //insert the kind name of the elements you want to search for here
			CComBSTR bstrKind = ""; 
			CComBSTR bstrLevel = "", 
				bstrName = "", 
				bstrObjType = "", 
				//bstrObjType = "Atom Properties",  //this is what the GME properties box says, but this doesn't work... 
				bstrProject = "", 
				bstrRole = "";

			pFilter->put_Name(bstrName);
			pFilter->put_Level(bstrLevel);
			pFilter->put_ObjType(bstrObjType);
			pFilter->put_Role(bstrRole);

			pFilter->put_Kind(bstrKind);
			CComPtr<IMgaFCOs> pFCOList;

			project->AllFCOs(pFilter, &pFCOList);
			if(!pFCOList)
				AfxMessageBox("fco list empty!");
			//CComPtr<IMgaFCO> pFCO;
			long nCount;
			pFCOList->get_Count(&nCount);
			CString strMessage;
			strMessage.Format(" fco list contains %d  elements", nCount);
			AfxMessageBox(strMessage);
			MGACOLL_ITERATE(IMgaFCO, pFCOList)
			{
				CComPtr<IMgaFCO> pFCO = MGACOLL_ITER;
				ASSERT(pFCO);
				CComBSTR bstrName;
				pFCO->get_Name(&bstrName);
				AfxMessageBox(CString("found ") + CString(bstrKind) + " : [" + CString(bstrName) + "]");

			}MGACOLL_ITERATE_END; //pFCO

			} 
			///////end code insertion/////////

-----Original Message-----
From: GME Group 
Sent: Tuesday, April 29, 2003 12:28 PM
To: GME List
Subject: FW: IMgaFilter



----------
From: 	Brian Willams
Sent: 	Tuesday, April 29, 2003 12:28:21 PM
To: 	GME Group
Subject: 	IMgaFilter
Auto forwarded by a Rule

Can anyone explain to me how IMgaFilter works? I haven't been very successful trying to get it to work on my own. 

I want to be able to get all atoms or models from a project. Or, get all of a certain kind from the meta from a project using IMgaProject->AllFCOs, but I have been having trouble setting the properties of the IMgaFilter.

Brian



More information about the gme-users mailing list