描述:
我已经用ATL在Word中加了一个按钮,我想在点击此按钮后跳出一个无模式对话框,然后再通过此无模式对话框对Word进行操作,如点击一下无模式对话框的一个按钮就可以在Word中插入一张图等。我不知如何创建此对话框,是用Insert中的NEW ATL OBJECT 中选 Micellaneous 中的Dialog还是在资源中直接添加一个对话框.
我是用Insert中的NEW ATL OBJECT 中选 Micellaneous 中的Dialog建立了一个对话框然后在点击word里的按钮中调用dlg.domodle()
然后我想在点击此对话框的一个按钮后在word中插入一张图,我是这么写的。
LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
CComPtr<MSWord::_Application> m_spApp;
CComQIPtr<MSWord::_Application> spApp(m_spApp->Application);
CComPtr<MSWord::Selection> m_sel;
CComPtr<MSWord::_Document> m_doc;
spApp->get_ActiveDocument(&m_doc);
spApp->get_Selection(&m_sel);
m_sel->InlineShapes->AddPicture("c:\Button1.bmp");
EndDialog(wID);
return 0;
}
编译没错但一运行就有错(我是说在点了无模式对话框的按钮后)
急啊!老师催要
解决方案1:
已经在
http://community.csdn.net/Expert/topic/3965/3965826.xml?temp=.4014704
给你回答了。