omarmf
asked on
delphi and interbase
Dear experts
is there any way to make an installar for my application that installs my softwar + interbase so the user do not need to install interbase then the software separetly
Thank you
is there any way to make an installar for my application that installs my softwar + interbase so the user do not need to install interbase then the software separetly
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Registry, IdGlobal, ShellAPI, ComCtrls;
type
TForm1 = class(TForm)
spb_Install: TSpeedButton;
Edit_Target: TEdit;
Edit_Result: TEdit;
spb_FireBird: TSpeedButton;
Memo: TMemo;
rbt_Overwrite: TRadioButton;
chbx_Details: TCheckBox;
ProgressBar: TProgressBar;
procedure FormCreate(Sender: TObject);
function InstallApp: Boolean;
procedure spb_InstallClick(Sender: TObject);
procedure spb_FireBirdClick(Sender: TObject);
procedure chbx_DetailsClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function CheckAboutFireBird: Boolean;
var
S: string;
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.LazyWrite := False;
Reg.OpenKey('SOFTWARE\Fire
S := Reg.ReadString('DefaultIns
finally
Result := DirectoryExists(S);
Reg.CloseKey;
Reg.Free;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if not CheckAboutFireBird then
begin
ShellExecute(handle, 'open', PChar('Firebird-1.5.2.4731
end;
end;
function TForm1.InstallApp: Boolean;
var
Bexe: Boolean;
Bgdb: Boolean;
SPath: string;
SFile: string;
TPath: string;
TFile: string;
begin
Bexe := True;
Bgdb := True;
try
Memo.Clear;
ProgressBar.Position := 0;
SPath := ExtractFilePath(Applicatio
SFile := SPath + 'App.exe';
TPath := Edit_Target.Text;
while (TPath[Length(TPath)]='\')
Delete(TPath, Length(TPath), 1);
ForceDirectories(TPath);
TFile := TPath + '\App.exe';
if not FileExists(TFile) then
Memo.Lines.Add('App.exe is not installed ')
else
begin
Memo.Lines.Add('App.exe is already installed ');
if (DeleteFIle(TFile)) then
Memo.Lines.Add('App.exe is deleted ');
end;
if not FileExists(TFile) or rbt_Overwrite.Checked then
begin
Bexe := CopyFileTo(SFile, TFile);
case Bexe of
True: Memo.Lines.Add('Installati
else Memo.Lines.Add('Installati
end;
end;
ProgressBar.Position := (ProgressBar.Max div 2);
SFile := SPath + 'MTV.GDB';
TFile := TPath + '\MTV.GDB';
if FileExists(TFile) then
Memo.Lines.Add('MTV.GDB already exists')
else
begin
Memo.Lines.Add(TFile);
Bgdb := CopyFileTo(SFile, TFile);
case Bgdb of
True: Memo.Lines.Add('Installati
else Memo.Lines.Add('Installati
end;
end;
finally
Result := Bexe and Bgdb;
ProgressBar.Position := ProgressBar.Max;
end;
end;
procedure TForm1.spb_InstallClick(Se
var
S: string;
begin
if not CheckAboutFireBird then
begin
S := 'Firebird is not Installed. Please install it first.';
end
else
begin
case InstallApp of
True: S := 'Installation of App.exe is successfull';
else S := 'Installation of App.exe is not successfull';
end;
Edit_Result.Text := S;
end;
end;
procedure TForm1.spb_FireBirdClick(S
begin
ShellExecute(handle, 'open', PChar('Firebird-1.5.2.4731
end;
procedure TForm1.chbx_DetailsClick(S
begin
case chbx_Details.Checked of
True: Height := 256;
else Height := 128;
end;
end;
end.