Problems sinking PartEvents, AssemblyEvents in C++

Problems sinking PartEvents, AssemblyEvents in C++

Anonymous
Not applicable
195 Views
0 Replies
Message 1 of 1

Problems sinking PartEvents, AssemblyEvents in C++

Anonymous
Not applicable
I know these seem to work OK in VB. I have had little problem with the ApplicationEvents, DocEvents etc sinks. However, the PartEvents and AssemblyEvents are defined to be IUnknown pointers. When I use code like this, cannot get to work:

// get the assy events object
CComQIPtr pAssyDoc (pDoc);
CComPtr pAssyCompDef;
CComPtr pUnk;
Result = pAssyDoc->get_ComponentDefinition (&pAssyCompDef);
if (FAILED (Result) || !pAssyCompDef)
return Result;
pAssyCompDef->get_AssemblyEvents (&pUnk);

// create the assy events handler
CComObject*pAssyEventsHdlr;
Result= CComObject::CreateInstance (&pAssyEventsHdlr);
if (FAILED (Result) || !pAssyEventsHdlr)
return Result;

// advise
Result = pAssyEventsHdlr->DispEventAdvise (pUnk);

I know this looks wierd and I'm not suprised it doesn't successfully sink the events. However, I have looked at all the help and samples (and google) and can find no help.

If anyone has been successful, please post a C++ way to connect to these events.

Any advice appreciated...
0 Likes
196 Views
0 Replies
Replies (0)