[gme-users] Decorator problems

Peter Volgyesi peter.volgyesi at vanderbilt.edu
Thu Aug 19 15:10:31 CDT 2004


You don't have to (must not) create the collection "by hand". Get rid of the
line containing the call to CoCreateInstance .
--
peter


> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu 
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf 
> Of Stefan Marte
> Sent: Thursday, August 19, 2004 1:28 PM
> To: gme-users at list.isis.vanderbilt.edu
> Subject: [gme-users] Decorator problems
> 
> Hmm, i am still stuck with the decorator i am trying to 
> write. can anybody tell me what is wrong with this piece of code?
> 
> cheers
> 
> Stefan
> 
> STDMETHODIMP CDecorator::GetPorts(IMgaFCOs **portFCOs) {
> 	//
> 	// TODO: Return a collection of mga objects represented 
> as ports.
> 	//
> 	VERIFY_INIT;
> 	CComPtr<IMgaFCOs> coll;
> 
> COMTHROW(coll.CoCreateInstance(OLESTR("Mga.MgaFCOs")));
> 
> 	if (m_mgaFco) {
> 		// we first try to get a IMgaModel
> 		try {
> 			CComQIPtr<IMgaModel> model(m_mgaFco);
> 			CComPtr<IMgaFCO> fco;
> 
> 			model->get_ChildFCOs(&coll);
> 			coll->get_Count(&portcount);
> 
> 			long i = portcount;
> 			for (long n = 1; n <= i; n++) {
> 				coll->get_Item(n,&fco);
> 			};	
> 		} catch (...) {
> 			// we are not an IMgaModel
> 			portcount = -1;
> 		};
> 	};
> 	portcount = 0;
> 	*portFCOs = coll.Detach();
> 	return S_OK;
> }
> 
> 
> 	
> 
> 	
> 		
> ___________________________________________________________
> Gesendet von Yahoo! Mail - Jetzt mit 100MB Speicher kostenlos 
> - Hier anmelden: http://mail.yahoo.de 
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users



More information about the gme-users mailing list