佚名通过本文主要向大家介绍了接口文档模板,申请开通模板消息接口,微信模板消息接口,模板消息接口内测申请,模板消息接口等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 如何定义一个有模板的接口+1个问题
描述:
解决方案1:
描述:
1.如何定义一个有模板的接口,包括idl怎么写
派生连接点的时候,有
template <class T>
class CProxy_IyEvents : public IConnectionPointImpl<T, &DIID__IyEvents, CComDynamicUnkArray>
{ //Warning this class may be recreated by the wizard.
像这样有模板的接口怎么写
2.VC自动添加的ATL对象都是和类一起添加的
怎么样只添加接口,不生成类方便一点
直接写??
解决方案1:
晕. 刚才罗嗦不少, 竟然没帖上去!:(
觉得你这样不行.
idl文档会被编译成.h .c文档, 而模板参数不能在这种情况下被定下来.至少目前的编译器不行吧.
你可以用其他方法达到目标.
如:
template <class T>
class DispatchConvert
{
public:
DispatchConvert(T *pUnk)
{
pUnk->AddRef();
}
~DispatchConvert()
{
m_pUnk->Release();
}
operator IDispatch * () {}
};
使用
Add(DispatchConvert(pUnk));