H
holk leng
I wrote a word addin dll by ATL, my purpose is to be notified to extract some
content text when the document is being closed. My addin runs well on
word2000,but always crushed with word2003 when closing the word application.
here is my sample code:
public IDispatchImpl<IAddin, &IID_IAddin, &LIBID_BDSWORDADDINLib>,
public IDispatchImpl<_IDTExtensibility2, &IID__IDTExtensibility2,
&LIBID_AddInDesignerObjects>,
public IDispEventSimpleImpl<1,CAddin,&__uuidof(MSWord::ApplicationEvents2)>
......
BEGIN_SINK_MAP(CAddin)
SINK_ENTRY_INFO(1,__uuidof(MSWord::ApplicationEvents2),2,Quit,&QuitInfo)
SINK_ENTRY_INFO(1,__uuidof(MSWord::ApplicationEvents2),4,DocumentOpen,&DocumentOpenInfo)
SINK_ENTRY_INFO(1,__uuidof(MSWord::ApplicationEvents2),6,DocumentBeforeClose,&DocumentSaveInfo)
SINK_ENTRY_INFO(1,__uuidof(MSWord::ApplicationEvents2),8,DocumentBeforeSave,&DocumentBeforeSaveInfo)
END_SINK_MAP()
I found if I comment out the DocumentBeforeClose event sink above
,everything is ok, or else error occurs when closing the application, even I
let the DocumentBeforeClose function do nothing.
why? Could someone tell me the solution to handle this? Thanks.
content text when the document is being closed. My addin runs well on
word2000,but always crushed with word2003 when closing the word application.
here is my sample code:
public IDispatchImpl<IAddin, &IID_IAddin, &LIBID_BDSWORDADDINLib>,
public IDispatchImpl<_IDTExtensibility2, &IID__IDTExtensibility2,
&LIBID_AddInDesignerObjects>,
public IDispEventSimpleImpl<1,CAddin,&__uuidof(MSWord::ApplicationEvents2)>
......
BEGIN_SINK_MAP(CAddin)
SINK_ENTRY_INFO(1,__uuidof(MSWord::ApplicationEvents2),2,Quit,&QuitInfo)
SINK_ENTRY_INFO(1,__uuidof(MSWord::ApplicationEvents2),4,DocumentOpen,&DocumentOpenInfo)
SINK_ENTRY_INFO(1,__uuidof(MSWord::ApplicationEvents2),6,DocumentBeforeClose,&DocumentSaveInfo)
SINK_ENTRY_INFO(1,__uuidof(MSWord::ApplicationEvents2),8,DocumentBeforeSave,&DocumentBeforeSaveInfo)
END_SINK_MAP()
I found if I comment out the DocumentBeforeClose event sink above
,everything is ok, or else error occurs when closing the application, even I
let the DocumentBeforeClose function do nothing.
why? Could someone tell me the solution to handle this? Thanks.