Author: Jonas Bilinkevicius
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:
1 function isbdepresent: boolean;
2 var3 IdapiPath: array[0..255] of Char;
4 IdapiHandle: THandle;
5 begin6 result := false;
7 GetProfileString('IDAPI', 'DLLPath', 'C:\', IdapiPath, 255);
8 {next lines isolates the first directory path from the IdapiPath in case 9 there are more}10 if Pos(';', StrPas(IdapiPath)) <> 0 then11 begin12 StrPCopy(IdapiPath, Copy(StrPas(IdapiPath), 1, Pred(Pos(';',
13 StrPas(IdapiPath)))));
14 end;
15 IdapiHandle := LoadLibrary(StrCat(IdapiPath, '\IDAPI01.DLL'));
16 if IdapiHandle < HINSTANCE_ERROR then17 result := false
18 {IDAPI is not present on this system}19 else20 begin21 FreeLibrary(IdapiHandle);
22 result := true;
23 {IDAPI is present on this system}24 end;
25 end;
Solve 2:
Try to check the registry for the presence of the BDE:
26 with TRegistry.create do27 begin28 Rootkey := HKEY_LOCAL_MACHINE;
29 OpenKey('SOFTWARE\BORLAND\DATABASE ENGINE', false);
30 CFGFile := ReadString('CONFIGFILE01');
31 Free;
32 end;
Solve 3:
you can try to initialize the BDE
33 34 IsBDEExist := (dbiInit(nil) = 0)