Fórum Como faço para saber se o bde já está instalado na máquina ? #161497
20/05/2003
0
PRECISO DESCOBRIR SE O BDE ESTÁ INSTALADO NA MÁQUINA...SE NAUM ESTIVER MINHA APLICAÇÃO VAI INSTALAR SE JÁ TIVER INSTALADO SÓ VOU CRIAR O ALIAS..CREIO QUE SEJA SIMPLES ALGUÉM PODE ME AJUDAR ???
AGRADEÇO ANTECIPADAMENTE !!!
AGRADEÇO ANTECIPADAMENTE !!!

Morpheus
Curtir tópico
+ 0
Responder
Posts
21/05/2003
Neo_coder®
Vc pode checar se esta chave se encontra no registro:
HKEY_LOCAL_MACHINE\SOFTWARE\Borland\Database Engine
Tenho este código de exemplo abaixo, mas só irá funcionar em win2000 em contas com direito de Administrador.
procedure TfmStopBDE.ReadWriteBDEStatus( Writing : Boolean;
WantBDEOn: Boolean);
{----------------------------------------------------------------------------------------------------------------------}
{ Read or write the value for the BDE path in the registry. }
{ If Writing is True, then the WantBDEValue will uncomment the registry path, otherwise it comments the registry path. }
{ If Writing is False, then it reads the BDE path in the registry and assigns it to the variable BDEDir (the registry }
{ is not changed and the WantBDEOn variable is ignored. }
{----------------------------------------------------------------------------------------------------------------------}
begin
BDEDir := ´´;
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(cBDEKey, False) then
begin
BDEDir := ReadString(cBDEValue);
if Writing then
begin
if WantBDEOn and (Copy(BDEDir,1,1) = cComment) then
Delete(BDEDir,1,1)
else if not(WantBDEOn) and (Copy(BDEDir,1,1) <> cComment) then
BDEDir := cComment + BDEDir;
WriteString(cBDEValue, BDEDir);
end;
end
else
begin
buOn.Enabled := false;
buOff.Enabled := false;
Raise Exception.Create(´BDE is not installed´+#1310+
´Registry Key: HKEY_LOCAL_MACHINE´+cBDEKey+´´ is missing in the registry.´);
end;
finally
Free;
StatusBar1.SimpleText := BDEDir;
end;
end;
Jesus Cristo Vive e é o Senhor.
HKEY_LOCAL_MACHINE\SOFTWARE\Borland\Database Engine
Tenho este código de exemplo abaixo, mas só irá funcionar em win2000 em contas com direito de Administrador.
procedure TfmStopBDE.ReadWriteBDEStatus( Writing : Boolean;
WantBDEOn: Boolean);
{----------------------------------------------------------------------------------------------------------------------}
{ Read or write the value for the BDE path in the registry. }
{ If Writing is True, then the WantBDEValue will uncomment the registry path, otherwise it comments the registry path. }
{ If Writing is False, then it reads the BDE path in the registry and assigns it to the variable BDEDir (the registry }
{ is not changed and the WantBDEOn variable is ignored. }
{----------------------------------------------------------------------------------------------------------------------}
begin
BDEDir := ´´;
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(cBDEKey, False) then
begin
BDEDir := ReadString(cBDEValue);
if Writing then
begin
if WantBDEOn and (Copy(BDEDir,1,1) = cComment) then
Delete(BDEDir,1,1)
else if not(WantBDEOn) and (Copy(BDEDir,1,1) <> cComment) then
BDEDir := cComment + BDEDir;
WriteString(cBDEValue, BDEDir);
end;
end
else
begin
buOn.Enabled := false;
buOff.Enabled := false;
Raise Exception.Create(´BDE is not installed´+#1310+
´Registry Key: HKEY_LOCAL_MACHINE´+cBDEKey+´´ is missing in the registry.´);
end;
finally
Free;
StatusBar1.SimpleText := BDEDir;
end;
end;
Jesus Cristo Vive e é o Senhor.
Responder
Gostei + 0
23/05/2003
Carnette
PRECISO DESCOBRIR SE O BDE ESTÁ INSTALADO NA MÁQUINA...SE NAUM ESTIVER MINHA APLICAÇÃO VAI INSTALAR SE JÁ TIVER INSTALADO SÓ VOU CRIAR O ALIAS..CREIO QUE SEJA SIMPLES ALGUÉM PODE ME AJUDAR ???
AGRADEÇO ANTECIPADAMENTE !!!
Função para descobrir se o BDE existe na máquina
uses
BDE;
function CheckBDEInstalled: Boolean;
begin
Result := (dbiInit(nil) = DBIERR_NONE)
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if CheckBDEInstalled then
ShowMessage(´BDE is installed.´)
else
ShowMessage(´BDE is not installed.´)
end;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)