Page 1 of 1

Activate TeePro extensions in my app.

Posted: Tue Feb 14, 2012 2:38 pm
by 16560694
My app uses runtime libraries, and also depends on the teepro extensions. Unfortunately the initialization section of the units are not called if they are not in the uses list of the main app, or if no code from the unit is directly linked into my own units.

Is there an 'easy' way to ensure all "pro" extensions are activated? I can do this by calling LoadPackage('Teepro916.bpl'), or by adding all pro units to tot uses list of the main app.

Any other useful tips?

Regards - Hans

Re: Activate TeePro extensions in my app.

Posted: Fri Feb 17, 2012 4:06 pm
by yeray
Hi Hans,

Excuse us for the delay here.
We haven' forgotten you and we'll be back to you asap.

Re: Activate TeePro extensions in my app.

Posted: Mon Feb 20, 2012 10:17 am
by narcis
Hi Hans,

What about adding TeeEditPro unit to your uses section? Which exact problem do you have? Any specific unit missing?

Thanks in advance.

Re: Activate TeePro extensions in my app.

Posted: Tue Feb 28, 2012 8:38 am
by 16560694
My app uses a plugin system for extenstions. These plugins are simply runtime packages that are in a subfolder and loaded during runtime.
In order to do this I have a kernel bpl and a very minimalistic exe file that depends only on some vcl runtime libs and the kernel bpl.
The kernel itself depends on the tchart libs, but does not require the tchart pro extensions.

Nevertheless, our end users want to use some of the pro features. But the pro features are not visible because the initialization sections of the corresponding packages are not executed when they are not explicitely mentioned in the exe uses list.
so: the problem is : I cannot see the tchartpro extensions in my tchart editor, only the tchart basic functionality

mycurrent solution now is a routine that scans all loaded bpl's and ensures all units are initialized like this:

Code: Select all

procedure InitializePackages(VAR aPackageList:THandleList);

  function lclInPackageList(const aHandle:Thandle):boolean;
  begin
    Result:=Assigned(aPackageList) and (aPackageList.IndexOf(aHandle)>=0)
  end;

  function lclIsPackage(aHandle:THandle):boolean;
  begin
    Result:=(aHandle<>0)
            and (GetProcAddress(aHandle, 'Initialize')<>nil)
            and (GetProcAddress(aHandle, 'Finalize')<>nil);
  end;

VAR Module:PLibModule;
begin
  Module := LibModuleList;
  while Module <> nil do
  begin
    if (Module.Instance<>0)
       and not lclInPackageList(Module.Instance)
       and lclIsPackage(Module.Instance) then
    begin
      if aPackageList=nil then
        aPackageList:=THandleList.Create;
      try
        InitializePackage(Module.Instance);
        aPackageList.Add(Module.Instance);
      except
        raise EModuleListError.CreateFmt('InitializePackages failed for [%s]',[ModuleFileName(Module.Instance)]);
      end;
    end;
    Module:=Module.Next;
  end;
end;
(off course there is also a counterpart for this)

Should adding TeeEditPro to my uses list (preferably only in my kernel.bpl) add/register all pro features? - Using XE2

(I was delayed a bit too - I had a one-week holiday )
Regards - Hans

Re: Activate TeePro extensions in my app.

Posted: Thu Mar 01, 2012 3:19 pm
by yeray
Hi Hans,

As you'll see, the Pro classes are registered in the beginning of TeeEdiPro.pas. Isn't adding that unit to you uses clause solving the issue for you?