Com小结(VC)

1.编写COM
    接口的声明:2处
            .idl file
                interface IPage : IDispatch{
                         [id(1), helpstring("Method Update")] HRESULT Update([in] LONG bSave);
                         ...
                         [id(31), helpstring("Method OpenLinkedTopics")] HRESULT OpenLinkedTopics([in] LONG nLinkWay, [in] LONG nLinkType);
                };

            .h file
                STDMETHOD(Update)(LONG bSave);

    接口的实现:1处
            .cpp file
STDMETHODIMP Page::Update(LONG bSave)
{
 AFX_MANAGE_STATE(AfxGetStaticModuleState());

 HRESULT hres = S_FALSE;

 if (m_pPage)
 {
  if (m_pPage->update(bSave))
   hres = S_OK;
 }

 return hres;
}
2.使用COM

展开阅读全文

没有更多推荐了,返回首页