atl实现word插件的问题,如何在word中插入activex控件并调用其方法?
本人最近在做word插件相关开发,按照网上的一些例子,用atl实现,在word中添加了自定义的按钮,现在想在触发按钮的点击事件时插入一个activex控件,并调用activex控件中的方法。activex控件是用mfc开发的,里面提供有一个方法:BSTR SetupMon(LPCTSTR Data);
目前插入activex控件的已经实现,就是不知如何调用它的方法,相关代码如下:
void __stdcall CMyAddin::OnClickButton1(IDispatch * /*Office::_CommandBarButton**/ Ctrl,VARIANT_BOOL * CancelDefault)
{
CComQIPtr <Office::_CommandBarButton> spBtn1(Ctrl);
CComQIPtr <Word::_Application> spApp;
CComQIPtr <Word::_Document> spDoc;
CComQIPtr <Word::InlineShapes> spInS;
CComVariant vtClassType;
CComBSTR bsClassType("MYOCX.MyocxCtrl.1");
vtClassType=bsClassType;
spApp=spBtn1->GetApplication();
spDoc=spApp->GetActiveDocument();
spInS=spDoc->GetInlineShapes();
spInS->AddOLEControl(&vtClassType);//通过AddOLEControl方法已将myocx这个activex控件加入到word中
//下面该如何调用activex控件中的SetupMon方法?
}
希望大家给予帮助,万分感谢!!