DelphiFAQ Home Search:

Enumerating Borland Application Servers

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

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.
You don't like the formatting? Check out SourceCoder then!

Comments:

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: