Defining the Uninstall Component

From InterBase
Jump to: navigation, search

Go Up to Writing Installation Wizards


Use the TIBUnInstall component to define which components are removed and what messages are displayed when the user uninstalls InterBase. The following code snippet shows a simple uninstall component.

procedure TUninstall.bUninstallClick(Sender: TObject);
begin
IBUninstall1.UnInstallFile := 'C:\Program Files\InterBase Corp\InterBase\ibuninst.000';
bUninstall.Visible := False;
ProgressBar1.Visible := True;
try
IBUninstall1.UnInstallCheck;
except
on E:EIBInstallError do
begin
Application.MessageBox(PChar(E.Message), PChar('Precheck Error'), MB_OK);
Label1.Caption := '';
bUninstall.Visible := True;
ProgressBar1.Visible := False;
Exit;
end;
end;
try
IBUninstall1.UnInstallExecute;
except
on E:EIBInstallError do
begin
Application.MessageBox(PChar(E.Message), PChar( 'Install Error'), MB_OK );
Label1.Caption := '';
bUninstall.Visible := True;
ProgressBar1.Visible := False;
Exit;
end;
end;
Label1.Caption := 'Uninstall Completed';
ProgressBar1.Visible := False;
bCancel.Visible := False;
bExit.Visible := True;
end;