我写的一个com中有一个长时操作的过程,所以需要做一个事件来显示操作的进度,各位是否能提供参考,如不用事件,是否有更好的办法!!不考虑用回调函数!!

解决方案 »

  1.   

    Read the book "ATL Internals" 
    Seven steps to connectable object
    1. You need to implement the IConnectionPointContainer interface
    2. QueryInterface should respond to requests for IID_IConnectionPointContainer 
    3. You need to implement the IConnectionPoint interface for each source interface supported by the connectable object
    4. You need to provide a connection map, that is, a table that associates an IID with a connection point implementation.
    5. You must update the coclass definition for the connectable object class in you IDL file to  specify each source interface. Each source interface must have the [source] attribute. The primary source interface should have the [default,source] attributes.
    6. Typically, you will want helper methods that call the sink methods for all connected sinks
    7. You must call the helper methods at the appropriate times.
      

  2.   

    把现实窗口的就handle传到com里,然后发消息给窗口就可以了!