Проверка наличия IDAPI
{codecitation class=»brush: pascal; gutter: false;» width=»600px»}
unit Findbde;
interface
implementation
uses
Controls, SysUtils, WinTypes, WinProcs, Dialogs;
var
IdapiPath: array[0..255] of Char;
IdapiHandle: THandle;
initialization
GetProfileString(‘IDAPI’, ‘DLLPath’, ‘C:\’, IdapiPath, 255);
{следующие строки «изолируют» первый путь к каталогу
из IdapiPath в случае, если их несколько}
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
begin
if MessageDlg(‘ОШИБКА: Borland Database Engine (IDAPI) не найдена’
‘перед следующей попыткой ее необходимо установить….’,
mtError, [mbOK], 0) = mrOK then
Halt
end
{ IDAPI в системе не установлена }
else
begin
FreeLibrary(IdapiHandle);
{ IDAPI Установлена в системе }
end;
end.
{/codecitation}