OLE Servers "Confused"

Hi Roy from Roy....

Well no one seems a bit interested in helping within a time frame that would
have been helpful, so I think I will reply to myself in this instance, and
maybe set up a tutorial based on this particular problem.

I will be using a Treeview control to display and manage the server and it
properties, this allows me to do away with having to maintain the server in
a local list etc. It will also save me time when refrencing the server and
allows the logical relationships of groups and Items to be shown intuativly.

The first step is inistilize the server like the following Example.

var
 OPCServer : IOPCServerDisp;

procedure TfrmMain.InitializeServer(OPCClassName: String);
var
  ServerNode: TTreeNode;
  ServerListItem: integer;
  S: String;
begin
    // This is how it works...
    // We can now also provide code insite.

   OpcServer := CreateOleObject(OPCClassName) as IOPCServerDisp;
   if OpcServer <> nil then
   begin
       ServerNode := Tree.Items.Add(nil, OpcServer.VendorInfo);
       ServerNode.data := @OpcServer;
  end else
                raise EServerError.Create('The System was unable to load the
server');

  CallBackConnWord := 0;
  AsyncWriteConnWord := 0;
end;

As the above example shows, we can declare the OPCServer var as a Dispach
interface and not a variant, thus enabling Delphi's code insite, we can also
attach the server refrence to the particular tree nodes data property also.

The next tutorial we will deal with the properties of the server and how to
refrence then correctly.

Direct refrencing and also refrencing them as pointers from our tree nodes
etc...

Till then. Bye.

Royboy...