2006. szeptember 12., kedd

Check if the BDE is installed


Problem/Question/Abstract:

I want to run the BDE install from my own setup application. Before I run the BDE installation, I would like to check that BDE is installed.

Answer:

Solve 1:

function isbdepresent: boolean;
var
  IdapiPath: array[0..255] of Char;
  IdapiHandle: THandle;
begin
  result := false;
  GetProfileString('IDAPI', 'DLLPath', 'C:\', IdapiPath, 255);
  {next lines isolates the first directory path from the IdapiPath in case
        there are more}
  if Pos(';', StrPas(IdapiPath)) <> 0 then
  begin
    StrPCopy(IdapiPath, Copy(StrPas(IdapiPath), 1, Pred(Pos(';',
      StrPas(IdapiPath)))));
  end;
  IdapiHandle := LoadLibrary(StrCat(IdapiPath, '\IDAPI01.DLL'));
  if IdapiHandle < HINSTANCE_ERROR then
    result := false
      {IDAPI is not present on this system}
  else
  begin
    FreeLibrary(IdapiHandle);
    result := true;
    {IDAPI is present on this system}
  end;
end;


Solve 2:

Try to check the registry for the presence of the BDE:

with TRegistry.create do
begin
  Rootkey := HKEY_LOCAL_MACHINE;
  OpenKey('SOFTWARE\BORLAND\DATABASE ENGINE', false);
  CFGFile := ReadString('CONFIGFILE01');
  Free;
end;


Solve 3:

you can try to initialize the BDE

IsBDEExist := (dbiInit(nil) = 0)

Nincsenek megjegyzések:

Megjegyzés küldése