Mapping an event to a C++ class function?

S

Scott Metzger

Hi,

Ok, I have figured out how to map a C function to a Visio event. Like this:
IUnknown FAR* pSink = NULL;
CVisioEventList vsoEList;
CVisioEvent vsoEvent;

if ( SUCCEEDED(vsoApp.EventList(vsoEList)) )
{
if (SUCCEEDED(CoCreateAddonSink(ShapeAdded, &pSink)) )
{
if ( SUCCEEDED(vsoEList.AddAdvise( (short)(visEvtShape |
visEvtAdd), VVariant(pSink), VBstr(_T("")),
VBstr(_T("")),vsoEvent)) )
{
vsoEvent.ID(&stclEventID);
}
} // end if created sink event
} // end if got list of events

ShapeAdded is the name of the function.

Now how can I map an event to a function in a class?

When I try to put a class function name in the CoCreateAddonSink call I
get the following error:
c:\Projects\Ice Visio Automation\VisioAutomation.cpp(67): error C2664:
'CoCreateAddonSink' : cannot convert parameter 1 from 'HRESULT (IUnknown
*,short,IDispatch *,long,long,IDispatch *,VARIANT,VARIANT *)' to
'LPVISEVENTPROC'

Thanks,
Scott Metzger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top