Fórum Verificar se já tem o BDE Instalado. Alguem sabe como? #356642
05/04/2008
0
Alguem sabe como???
Desde já agradeço a colaboração de todos ^^

Mortify
Curtir tópico
+ 0Posts
05/04/2008
Martins
Essa dica eu nunca testei, pois faz tempo q deixei de usar BDE, mas existe em truques e dicas sobre Delphi e vc pode encontrá-la pela NET.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | procedure Verifica_BDE; const Key_Root = HKEY_LOCAL_MACHINE; Key_Data : Array[00..05, 01..03] Of String = ((´Software\Borland\Database Engine´, ´BDE_EXTERNAL´, ´0´), (´Software\Borland\Database Engine´, ´DLLPATH´ , ´0´), (´Software\Borland\Database Engine´, ´CONFIGFILE01´, ´1´), (´Software\Borland\BLW32´ , ´BLAPIPATH´ , ´0´), (´Software\Borland\BLW32´ , ´LOCALE_LIB1´ , ´5´), (´Software\Borland\BLW32´ , ´LOCALE_LIB2´ , ´6´)); BDE_Files : Array[01..10] Of String = (´idapi32.cfg´, ´idapi32.dll´, ´idr20009.dll´, ´blw32.dll´, ´usa.btl´, ´europe.btl´, ´idpdx32.dll´, ´idasci32.dll´, ´iddbas32.dll´, ´idodbc32.dll´); var Status : Boolean; Index : Integer; Ind_Files : Integer; BDE_Dir : String; Registro : TRegIniFile; begin Try Registro := TRegIniFile.Create(); Registro.RootKey := Key_Root; If (Not Registro.KeyExists(Key_Data[0,1])) Or (( Registro.KeyExists(Key_Data[0,1])) And (Registro.ReadString(Key_Data[0,1], Key_Data[0,2], ´FALSE´) = ´TRUE´)) Then Begin For Index := 1 To 3 Do Begin Case Index Of 1 : BDE_Dir := ExtractFileDrive(ParamStr(0)) + ´\BDE\´; 2 : BDE_Dir := ExtractFileDir(ParamStr(0)) + ´\BDE\´; 3 : BDE_Dir := ExtractFilePath(ParamStr(0)); End; Status := DirectoryExists(BDE_Dir); If Status Then For Ind_Files := Low(BDE_Files) To High(BDE_Files) Do Status := Status And FileExists(BDE_Dir + BDE_Files[Ind_Files]); If Status Then Break; End; For Index := Succ(Low(Key_Data)) To High(Key_Data) Do Begin If Key_Data[Index,3] = ´0´ Then Registro.WriteString(Key_Data[Index,1], Key_Data[Index,2], BDE_Dir) Else Registro.WriteString(Key_Data[Index,1], Key_Data[Index,2], BDE_Dir + BDE_Files[StrToInt(Key_Data[Index,3])]); End; Registro.WriteString(Key_Data[0,1], Key_Data[0,2], ´TRUE´); End; Finally Registro.Free; End; end; |
Detalhe, coloque no USES a unit [b:afdf8d189a]Registry[/b:afdf8d189a]
Boa sorte e bons códigos.
Gostei + 0
05/04/2008
Mortify
Eu já tinha dado uma olhada nele no guia do hardware:
[url]http://www.guiadohardware.net/comunidade/executavel-delphi/179899/[/url]
Só que ele é sugeito a erros (pelo menos para o qe eu quero)
>> Se o cara deleta o BDE na mão e não apagar o Registro não vai funcionar <<
Eu achei esse código aqui:
1 | IsBDEExist := Check(dbiInit(nil)) |
Esse código tenta inicializar o BDE
So que aqui não está funcionando
Deve ter que declara alguma coisa na unit
E eu não sei o que é.. =\
Se alguem souber
por favor Help Me
Gostei + 0
05/04/2008
Emerson Nascimento
Gostei + 0
05/04/2008
Mortify
E ainda continuou dando o mesmo erro:
1 | [Error] Principal.pas(138): Undeclared identifier: ´IsBDEExist´ |
Gostei + 0
05/04/2008
Emerson Nascimento
na verdade a variável pode ter qualquer nome:
1 2 3 4 5 6 7 8 | var BDEInstalado: boolean; begin BDEInstalado := Check(dbiInit(nil)); if not BDEInstalado then ShowMessage(´O BDE não está instalado nesta estação!´); end; |
Gostei + 0
06/04/2008
Mortify
E eu pensando q era comando
huahuahuahuahuahu
Um dia eu chego lá xD
Brigadão[/b:8f2b8a241e]
Gostei + 0
06/04/2008
Mortify
Deu incompatibilidade de tipos
Olha o erro ai:[/b:c83437bc31]
1 | [Error] Principal.pas(138): Incompatible types: ´LongBool´ and ´procedure, untyped pointer or untyped parameter´ |
[b:c83437bc31]Mais eu consegui fazer da seguinte forma:[/b:c83437bc31]
1 2 3 4 | If DbiInit(nil) <> DBIERR_NONE Then Begin ShowMessage(´O BDE não está instalado nesta estação!´); End; |
[b:c83437bc31]Valeuzão ai mano
Brigado pela força
Vou posta depois o codigo todo
Sempre tem um noob = eu precisando
(O código serve para instalar o aliase quando abre o programa)
UM DIA EU CHEGO LÁ [size=18:c83437bc31][color=red:c83437bc31]0/[/color:c83437bc31][/size:c83437bc31][/b:c83437bc31]
Gostei + 0
07/04/2008
Martins
1 2 3 4 5 6 7 8 9 | var IsBDEExist : LongBool; begin IsBDEExist := (dbiInit(nil) = 0); If IsBDEExist = true then Edit1.Text := ´BDE já instalado!!!´ else Edit1.Text := ´BDE não instalado!!!´; end; |
Pelo menos dessa forma sei q funcionou aqui, desculpe não ter ajudado antes, é q não uso mais BDE.
Mas vc já conseguiu a solução, deixaremos então os dois códigos para q sirva para outros colegas.
Gostei + 0
26/05/2008
Jlsmendes
Declaro uma função no form:
function DllRegisterServer:integer; stdcall; external ´BdeInst.dll´;
Testo se o BDE está instalado com a função que vocês passaram e chamo a função de instalação caso o BDE não esteja instalado, é bem simples, mas funcionou.
procedure TfrmPrincipal.FormCreate(Sender: TObject);
begin
If DbiInit(nil) <> DBIERR_NONE Then
Begin
ShowMessage(´O BDE não está instalado nesta estação clique OK para instalar!´);
DllRegisterServer;
End;
end;
E mais uma vez obrigado pelas dicas!
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)