P
Praveen
I am using some of the sample code provided in the visio documentation
and I am noticing some strange behavior. With the following code, I
get an event when I open the template from the code. However, if I
comment out the call pDocuments->Add and try to open the document from
the Visio GUI, the document opens but a window pops up saying:
"The action cannot be completetd because the other program is busy
...."
and stays like this forever. Now, if I quit my test code (wherein I
call pApplication->quit), another window pops up saying:
"You cannot quit Visio because a program is handling an event from
Visio. If VBA is at a breakpoint, reset VBA then quit again"
Any help/suggestions/comments would be highly appreciated.
============================
CoCreateAddonSink(ReceiveNotifyFromVisio, &pSink)
hr = pApplication->get_EventList(&pEventList);
pEventList->AddAdvise(visEvtCodeDocCreate,
VVariant(this),
VBstr(""),
VBstr(""),
&pEvent);
hr = pApplication->get_Documents(&pDocuments);
IVDocument* pTemplate = NULL;
hr = pDocuments->Add(VBstr("Basic Diagram.vst"), &pTemplate);
......
......
============================
HRESULT STDMETHODCALLTYPE ReceiveNotifyFromVisio (
IUnknown *ipSink,
short nEventCode,
IDispatch *pSourceObj,
long nEventID,
long nEventSeqNum,
IDispatch *pSubjectObj,
VARIANT vMoreInfo,
VARIANT *pvResult)
{
HRESULT hr = 0;
printf("Got event %d\n", nEventCode);
return hr;
}
============================
OS: XP
Visio 2000.
and I am noticing some strange behavior. With the following code, I
get an event when I open the template from the code. However, if I
comment out the call pDocuments->Add and try to open the document from
the Visio GUI, the document opens but a window pops up saying:
"The action cannot be completetd because the other program is busy
...."
and stays like this forever. Now, if I quit my test code (wherein I
call pApplication->quit), another window pops up saying:
"You cannot quit Visio because a program is handling an event from
Visio. If VBA is at a breakpoint, reset VBA then quit again"
Any help/suggestions/comments would be highly appreciated.
============================
CoCreateAddonSink(ReceiveNotifyFromVisio, &pSink)
hr = pApplication->get_EventList(&pEventList);
pEventList->AddAdvise(visEvtCodeDocCreate,
VVariant(this),
VBstr(""),
VBstr(""),
&pEvent);
hr = pApplication->get_Documents(&pDocuments);
IVDocument* pTemplate = NULL;
hr = pDocuments->Add(VBstr("Basic Diagram.vst"), &pTemplate);
......
......
============================
HRESULT STDMETHODCALLTYPE ReceiveNotifyFromVisio (
IUnknown *ipSink,
short nEventCode,
IDispatch *pSourceObj,
long nEventID,
long nEventSeqNum,
IDispatch *pSubjectObj,
VARIANT vMoreInfo,
VARIANT *pvResult)
{
HRESULT hr = 0;
printf("Got event %d\n", nEventCode);
return hr;
}
============================
OS: XP
Visio 2000.