Article ID: 145746
Article Last Modified on 11/21/2006
ULONG FAR EXPORT CEditPrintObj::CEditObj::AddRef()
{
METHOD_PROLOGUE(CEditPrintObj, EditObj)
return pThis->ExternalAddRef();
}
ULONG FAR EXPORT CEditPrintObj::CEditObj::Release()
{
METHOD_PROLOGUE(CEditPrintObj, EditObj)
return pThis->ExternalRelease();
}
HRESULT FAR EXPORT CEditPrintObj::CEditObj::QueryInterface(
REFIID iid, void FAR* FAR* ppvObj)
{
METHOD_PROLOGUE(CEditPrintObj, EditObj)
return (HRESULT)pThis->ExternalQueryInterface(&iid,
ppvObj);
}
void FAR EXPORT CEditPrintObj::CEditObj::EditObject()
{
METHOD_PROLOGUE(CEditPrintObj, EditObj)
// code to "Edit" the object, whatever that // means...
}
All of the function signatures are incorrect. CEditObj should actually be
XEditObj. The BEGIN_INTERFACE_PART and END_INTERFACE_PART macros create a
nested class inside the object class definition, and assign a name to the
nested class. The name of the nested class is created by prepending an X to
the first argument of the BEGIN_INTERFACE_PART macro, which should be the
name of your custom interface. Therefore, if you are going to implement the
functions in the nested classes that were created for you by the
BEGIN_INTERFACE_PART and END_INTERFACE_PART macros, the nested classes name
would always begin with an X. This is to distinguish the nested class from
global classes (which typically start with C) and interface classes (which
typically start with I).
ULONG FAR EXPORT CEditPrintObj::XEditObj::AddRef()
{
METHOD_PROLOGUE(CEditPrintObj, EditObj)
return pThis->ExternalAddRef();
}
BEGIN_INTERFACE_MAP(CAggrExample, CCmdTarget)
// native "INTERFACE_PART" entries go here
INTERFACE_AGGREGATE(CAggrExample, m_lpTypeInfo)
END_INTERFACE_MAP()
The variable m_lpTypeInfo should be m_lpAggrInner. The code should look
like this:
BEGIN_INTERFACE_MAP(CAggrExample, CCmdTarget)
// native "INTERFACE_PART" entries go here
INTERFACE_AGGREGATE(CAggrExample, m_lpAggrInner)
END_INTERFACE_MAP()
Keywords: kbautomation kbbug kbdocerr kbdocfix kbfix kbinprocsvr kbvc410fix KB145746