Home > Web Site Updates > IConnectionPointImplMT


January 23, 2007
As part of the new release of GPSCom, I have also released a new freeware class called IConnectionPointImplMT. This class implements an ATL class which implements the IConnectionPoint interface which is required to be implemented by COM server’s which fires events back to their clients. ATL already provides a IConnectionPointImpl class but the problem it has is that events must be fired from the thread (aka COM apartment) in which the COM server was originally created. IConnectionPointImplMT avoids this drawback by performing automatic marshaling of client interfaces acrosss COM apartments using the GIT (Global Interface Table). Put more simply, this class will allow you to fire events from your COM objects from a different thread than the one on which the object was initially created. The code was based on the MS Article "SAMPLE: ATLCPImplMT encapsulates ATL event firing across COM apartments" at http://support.microsoft.com/kb/280512 . As mentioned in this article, because the code uses the Global Interface Table, it requires Windows NT 4.0 Service Pack 3 or later, or Windows 95 (or later) with DCOM version 1.1 or later to be installed. Based on this original code, I have performed an extensive rewrite of the class using the ATL 8 "CComGITPtr" class. In addition it has been updated based upon the ATL 8 "IConnectionPointImpl" implementation. It also uses ATL::CSimpleArray to hold the GIT’ed interfaces rather than the CComDynamicUnkArray class. Note that this class unlike the rest of the code in GPSCom is licensed as open-source / freeware, meaning that you are free to use this class in your projects, without being required to register GPSCom
Categories: Web Site Updates
%d bloggers like this: