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
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