全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:789
推到 Plurk!
推到 Facebook!

有关COM+中Evens的Multi Client使用方法

缺席
JustinShen
中階會員


發表:22
回覆:104
積分:80
註冊:2003-09-20

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-05-30 12:48:02 IP:221.225.xxx.xxx 未訂閱
使用Automation Object生成含Evens的Interface后,Delphi7 生成如下代码 TEventIntf = class(TAutoObject, IConnectionPointContainer, IEventIntf) private { Private declarations } FConnectionPoints: TConnectionPoints; FConnectionPoint: TConnectionPoint; FEvents: IEventIntfEvents; { note: FEvents maintains a *single* event sink. For access to more than one event sink, use FConnectionPoint.SinkList, and iterate through the list of sinks. } public procedure Initialize; override; protected { Protected declarations } property ConnectionPoints: TConnectionPoints read FConnectionPoints implements IConnectionPointContainer; procedure EventSinkChanged(const EventSink: IUnknown); override; end; 为了激活多个客户端的Evens一般Delphi5-时使用如下代码获取SinkList IConnectionPoint.EnumConnections(ENum); while ENum.Next(1,ConnectData,@Fetched)=S_OK do (ConnectData.pUnk as IEventIntfEvents).OnEvent(); 这样做的原因是Delphi5-不会声称FConnectionPoint: TConnectionPoint; 然而,Delphi7 生成的代码中包含FConnectionPoint: TConnectionPoint; 是否可以直接使用FConnectionPoint.SinkList来遍历所有的Client。如何做? 我使用(FConnectionPoint.SinkList.Items[i] as IEventIntfEvents).OnEvent(); 有错误。 Justin Shen
------
====================
我为一切作努力!
Justin Shen

系統時間:2024-05-14 19:38:39
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!