Examples Delphi

There is no ready-to-use place in the registry where all (Borland) application servers have to register besides the standard list of classes.
The way to retrieve all registered Borland Application Servers is to enumerate all registered classes and check in each wether it has the subkey 'Borland DataBroker'. If this test is positive, then the program's ID can be retrieved and - in the example below - be added to a listbox where a user may choose from.

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
lbAppServers: TListBox;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
uses
Registry;
procedure TForm1.FormCreate;
var
i: Integer;
tmpServerList: TStringList;
begin
tmpServerList := TStringList.Create;
lbAppServers.Clear;
with TRegistry.Create do
begin
try
RootKey := HKEY_CLASSES_ROOT;
// look for all classes and enumerate all registered classes
if OpenKey('CLSID', False) then
begin
GetKeyNames(tmpServerList)
end;
// Check all registered classes whether they have
// the subkey 'Borland DataBroker'. In that case,
// retrieve the program's ID (default property)
// and add it to the list.
for i := 1 to tmpServerList.Count-1 do
begin
if KeyExists('CLSID\'+tmpServerList[i]+'\Borland DataBroker') then
begin
if OpenKey('CLSID\'+tmpServerList[i]+'\ProgID', False) then
begin
lbAppServers.Items.Add(ReadString(''));
end;
end;
end
finally
// close open keys and free the registry object
Free;
end;
end;
tmpServerList.Clear;
tmpServerList.Free;
end;
end.