ATL中的事件问题 我用ATL做一个服务器,选择了支持连接点的选项。但我在事件接口中添加方法后,然后右键点击实现类,再点击 实现连接点(Implement connection point) 但是在向导自动生成的CProxy...的类中,没有实现我在事件接口中添加的事件代理方法Fire_...怎样让代理类能看到我定义的事件接口的方法,然后让它自动生成Fire_XXX之类的实现。谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 模仿着写一个就可以了吧 HRESULT Fire_ExecutionOver(INT Result) { HRESULT ret; T* pT = static_cast<T*>(this); int nConnectionIndex; int nConnections = m_vec.GetSize(); for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) { pT->Lock(); CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex); pT->Unlock(); _IAddEvents* p_IAddEvents = reinterpret_cast<_IAddEvents*>(sp.p); if (p_IAddEvents != NULL) ret = p_IAddEvents->ExecutionOver(Result); } return ret; } 请参考http://www.codeproject.com/com/connectionpoint.asp 图形图像 图像移动问题 关于ISAPI的筛选器问题 如何实现对某个选定的文件禁止复制? SDI中有一个ListCtrl,如何实现在模态对话框还没关闭时,看出ListCtrl的最新更新内容? 如何删除COMBO 控件中的所有字段? 关于并口的问题 关于BIOS的简单问题,100分 我的vc怎么了?为什么我只要对一个类进行改动,它就从左边的类列表消失了? 给access数据库加口令后,为何在VC++中不能访问? 如何实现一点对多点的通讯 托盘图标闪烁效果怎么做的? 如何获得发出BN_CLICKED消息的按钮的控件ID
HRESULT Fire_ExecutionOver(INT Result)
{
HRESULT ret;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
_IAddEvents* p_IAddEvents = reinterpret_cast<_IAddEvents*>(sp.p);
if (p_IAddEvents != NULL)
ret = p_IAddEvents->ExecutionOver(Result);
} return ret;
}
http://www.codeproject.com/com/connectionpoint.asp