H
Haakon S.
I try to use the Visio ActiveX Control via a SDI application developed with
Visual C++ 6.0. Here's what I do:
I use Class Wizzard to create the class MFCSink derived from CCmdTarget. I
activate automation for the class. Further, in the class i define the function
void MFCSink::evtNotify(LPDISPATCH pDisp).
In the same file under the BEGIN_DISPATCH_MAP macro i specify:
DISP_FUNCTION_ID(MFCSink, "evtNotify",1,evtNotify, VT_EMPTY, VTS_DISPATCH)
In my CView-derived class I include the member MFCSink m_sink. Under the
InitialUpdate function of this file I specify:
LPDISPATCH pDisp=m_sink.GetIDispatch(FALSE);
VARIANT vartag=_variant_t(pDisp);
CVWindow wnd = m_DrawCtrl.GetWindow();
CVEventList eventlist=wnd.GetEventList();
eventlist.AddAdvise((short)visEvtAdd|(short)visEvtShape,vartag,"evtNotify",VTS_DISPATCH);
I have tried several alternatives instead of the last VTS_DISPATCH
parameter. The compiler never complains, but Visio comes up with a message
box saying "Invalid parameter" and the evtNotify function is never activated.
Can anybody please explain what I'm doing wrong here?
Regards, Haakon S.
Visual C++ 6.0. Here's what I do:
I use Class Wizzard to create the class MFCSink derived from CCmdTarget. I
activate automation for the class. Further, in the class i define the function
void MFCSink::evtNotify(LPDISPATCH pDisp).
In the same file under the BEGIN_DISPATCH_MAP macro i specify:
DISP_FUNCTION_ID(MFCSink, "evtNotify",1,evtNotify, VT_EMPTY, VTS_DISPATCH)
In my CView-derived class I include the member MFCSink m_sink. Under the
InitialUpdate function of this file I specify:
LPDISPATCH pDisp=m_sink.GetIDispatch(FALSE);
VARIANT vartag=_variant_t(pDisp);
CVWindow wnd = m_DrawCtrl.GetWindow();
CVEventList eventlist=wnd.GetEventList();
eventlist.AddAdvise((short)visEvtAdd|(short)visEvtShape,vartag,"evtNotify",VTS_DISPATCH);
I have tried several alternatives instead of the last VTS_DISPATCH
parameter. The compiler never complains, but Visio comes up with a message
box saying "Invalid parameter" and the evtNotify function is never activated.
Can anybody please explain what I'm doing wrong here?
Regards, Haakon S.