Packing a Paradox table

Use the following code to pack a Paradox table:

function PackParadoxTable(Tbl: TTable; Db: TDatabase):DBIResult;
  var
    TblDesc: CRTblDesc;
begin
  Result := DBIERR_NA;
  FillChar(TblDesc, SizeOf(CRTblDesc), 0);
  StrPCopy(TblDesc.szTblName, Tbl.TableName);
  TblDesc.bPack := True;
  Result := DbiDoRestructure(Db.Handle, 1, @TblDesc, nil, nil, nil, False);
end;

Note that a table passed as the first parameter must be closed.