AnnGetTopContainer example for Delphi

Procedure TForm1.AnnTestTopContainer();
var
   hPin: HANNOBJECT;
   h1: HANNOBJECT;
   h2: HANNOBJECT;
   hContainer: HANNOBJECT;
begin
   hContainer:= LEADAnn1.AnnCreate(ANNOBJECT_CONTAINER, True, False);
   if(hContainer <> 0)then
   begin
      hPin:= 0;
      LEADAnn1.AnnCreateItem(hContainer, ANNOBJECT_PUSHPIN, False, hPin);
      LEADAnn1.AnnGetContainer(hContainer, h1);
      LEADAnn1.AnnGetTopContainer(hPin, h2);
      if((h1 = h2) And (h1 = LEADAnn1.AnnContainer))Then
         ShowMessage('root container is same as that of LEADAnn1');
   end;
end;