techvanguards.com
Last updated on 1/25/2016

Downloads

Delphi libraries/samples

ComLib.zip (50k). Last Updated on 1/25/2016
for Delphi 3, Delphi 4, Delphi 5

ComLib is a library of useful COM routines and classes. It also contains the ThreadComLib COM threading library featured in my previous articles: "Understanding COM Threading using Delphi" and "Threading Options for Delphi COM Servers". Please see below for how to obtain these articles.

EventDemo.zip (400k). Last Updated on 1/25/2016
for Delphi 3, Delphi 4, Delphi 5
requires
ComLib.pas & ThreadComLib.pas

EventDemo demonstrates a simplified implementation of events (dispinterface callbacks) for Delphi 3, 4, 5. This demo contains the following:

  1. TEventSinks/TEventSink classes (ComLib.pas). TEventSinks is intended to be a replacement for the VCL TConnectionPoints class. These new classes have the following enhancements:

    - Fixes the memory leak problem in the VCL TEnumConnections/TEnumConnectionPoints (D3 and D4)
    - Allows easy implementation of triggering events for multiple sink clients (you don't have to do the cumbersome IEnumConnections iteration (D3/D4) or the FSinkList iteration (D5) everytime you need to trigger an event for multiple clients)
    - Allows easy implementation of a server object that supports multiple event interfaces (requires some amount of work if you simply use the native VCL classes)

    If you are familiar with Visual Basic's server-side event mechanism where all you have to do is to type :

    Public Event FooEvent 

    to declare an event, and to type 

    RaiseEvent FooEvent

    to trigger an event, this is what the TEventSinks & TEventSink classes are for. In other words, the hard way is to hack IConnectionPoint and IConnectionPointContainer and the easy way is to use TEventSinks/TEventSink :).
     
  2. TSingletonComObject and TSingletonAutoObject classes (ThreadComLib.pas). The singleton classes provide base implementation for Delphi COM objects that need to be only "single-instance" per server process. I've included singletons because events sometimes need to be tied to singleton classes.

DCOMHelloWorldSvc.zip (360k). Last Updated on 1/25/2016
for Delphi 4

This demonstrates a simple Delphi 4 COM server that is also an NT service.


Miscellaneous COM Articles

[These articles are rather old and outdated and may/may not accurately reflect behavior of current technology]

Implementing COM Component Callbacks in Delphi (1/98) for D3 [*]
Understanding COM Threading using Delphi (4/98) for D3/D4
Deconstructing OLE Automation (10/98) for D3/D4 [**]
Threading Options for Delphi COM Servers (11/98) for D3/D4
Optimizing Delphi COM Applications (7/99) for D3/D4 [***]

[*] Also published in the Delphi Informant magazine (by Binh Ly) June & July 1998 issues.

[**] Discontinued. However, rest assured, topics that were planned to be covered in parts 2 and 3 will be dispersed among the newer articles on this site. 

[***] Presented at the 10th Borland Conference (by Binh Ly) and is available on the proceedings CD.

Here's a Russian translation of some of the articles from a dedicated Delphi developer, Konstantin Lazarev. Many thanks to Konstantin! Translations >>
Copyright (c) 1999-2011 Binh Ly. All Rights Reserved.