TheSwamp

Code Red => ARX Programming => Topic started by: ahlzl on October 30, 2008, 11:14:23 AM

Title: about IUnknown question
Post by: ahlzl on October 30, 2008, 11:14:23 AM
Hello:
in ARX2002 SDK\samples\simpledynprops\categorizedproperty.cpp, have this code:
Code: [Select]
STDMETHODIMP CCategorizedProperty::GetCurrentValueData(/*in*/LONG objectID,
/*[out]*/VARIANT* pVarData)

in ARX2009, I use Dynamic Property Wizard, get this code:
Code: [Select]
STDMETHODIMP CCategorizedProperty::GetCurrentValueData(IUnknown *pUnk,
/*[out]*/VARIANT* pVarData)


I copy SDK2002'code, error!
how modify? thank you!
Title: Re: about IUnknown question
Post by: It's Alive! on November 02, 2008, 12:45:57 AM
Did you get this working? Sorry I know very little about COM. 
Title: Re: about IUnknown question
Post by: ahlzl on November 02, 2008, 03:37:42 AM
Daniel, this sample is OPM .
Title: Re: about IUnknown question
Post by: Alexander Rivilis on November 03, 2008, 04:50:05 AM
in ARX2009, I use Dynamic Property Wizard, get this code:
Code: [Select]
STDMETHODIMP CCategorizedProperty::GetCurrentValueData(IUnknown *pUnk,
/*[out]*/VARIANT* pVarData)
AcAxGetIUnknownOfObject and IAcadBaseObject.GetObjectId can help you.
Title: Re: about IUnknown question
Post by: ahlzl on November 04, 2008, 04:45:27 AM
thank you,Alexander Rivilis.

but I am fail :-(
how get AcDbObjectId from IUnknown?
thanks again!
Title: Re: about IUnknown question
Post by: Alexander Rivilis on November 04, 2008, 05:10:59 AM
Code: [Select]
  long oldid; ((IAcadObject *)pUnk)->get_ObjectID(&oldid);
  AcDbObjectId id; id.setFromOldId(oldid);
  AcDbHandle h = id.handle();
  ACHAR buf[17]; h.getIntoAsciiBuffer(buf);
  acutPrintf(_T("\nHandle is %s"),buf);
Title: Re: about IUnknown question
Post by: ahlzl on November 04, 2008, 06:14:52 AM
success !
thank you, greate Alexander Rivilis !