事件和连接点有什么区别啊?!怎么样实现事件源啊?
连接点好象是通过循环来访问连接对象的,在非属性化中能不能简单的提供事件源?

解决方案 »

  1.   

    csdn里也有很多这个话题的帖子,
      

  2.   

    1. a implements connection point
    2. b implements event sink interface
    3. b connect to a thru connection point
    4. when something happend (event), b notifies a thru event sink interface
      

  3.   

    sorry, mispelling
    1. a implements connection point
    2. b implements event sink interface
    3. b connect to a thru connection point
    4. when something happend (event), a notifies b thru event sink interface
      

  4.   

    还是不明白。
    如果一个IUnknown派生的接口,定义为[default, source],在实现的时候是连接点,
    那么他能用SINK_ENTRY来触发事件吗?
      

  5.   

    1。event就是message,
    2。而event sink是接收消息的地方。
    3。连接点是IConnectionPoint, 一个对象实现了IConnectionPoint,那么它是可连接对象。
    4。一个对象如果实现了IConnectionPoint, 那么它的客户就可以通过这个接口把客户的IUnknown接口传给这个对象,这样,这个对象,在特定的情况下才可能发送event给客户。
    5。如果客户想得到对象发送过来的event,它必须和对象协调传递event的方式,这就是outgoing interface,这个接口由对象来定义,由客户来实现。当对象处发生了某一事件,他会通过这个outgoing接口来通知客户程序。
      

  6.   

    client                                          object
                                                   implements IConnectionPoint interface
    Client connect to the object through 
                     IConnection interface -->
                                                   define an outgoing interface
    implement the outgoing interface
                                          <---     Send event through the outgoing interface
      

  7.   

    Client <==============>          ConnectionPtr<================>Control
      

  8.   

    if you need implement Connection Pointer .you need do it like step
    step1:  When you Insert ATL Object Check Connection Pointer 
    step2:Add Connection Pointer In you Class