Dear Wes,

Thanks for your message.
I check that iIntfLevel's value, it is 500. So I still can not distinguish it.

I found on Inprise website 
http://www.inprise.com/devsupport/bde/bdeapiex/dbigetsysversion.html
they got that sample. 
Unforunately they do not make a decision after 5, 
so I add code to test 5.11.
I look forward to other version check logic.

I have enclosed the code for your reference.

function DetermineMinorVersion(IntfVer, Month, Day, Year: integer): integer;
begin
  Result := -1;

  case IntfVer of
    3:
      begin
        if (Month = 12) and (Day = 1) and (Year = 1995) then
          Result := 0;
        if (Month = 2) and (Day = 4) and (Year = 1996) then
          Result := 10;
        if (Month = 6) and (Day = 1) and (Year = 1996) then
          Result := 11;
        if (Month = 8) and (Day = 22) and (Year = 1996) then
          Result := 12;
        if (Month = 9) and (Day = 19) and (Year = 1996) then
          Result := 50;
        if (Month = 12) and (Day = 2) and (Year = 1996) then
          Result := 51;
      end;

    4:
      begin
        if (Month = 3) and (Day = 11) and (Year = 1997) then
          Result := 0;
        if (Month = 7) and (Day = 16) and (Year = 1997) then
          Result := 1;
        if (Month = 10) and (Day = 28) and (Year = 1997) then
          Result := 50;
        if (Month = 11) and (Day = 14) and (Year = 1997) then
          Result := 51;
      end;
    5:
      begin
        if (Month = 11) and (Day = 4) and (Year = 1999) then
          Result := 11
        else
          Result := -1;
      end;
    end;
end;

function GetBdeVersion: string;
var
  Version: SYSVersion;
  Major: smallint;
  Minor: smallint;
  Month: word;
  Day: word;
  Year: smallint;
begin
  Result := 'Unknown';

  try
    try
      DbiInit(nil);
      DbiGetSysVersion(Version);
      DbiDateDecode(Version.dateVer, Month, Day, Year);
      Major := Version.iVersion div 100;
      Minor := DetermineMinorVersion(Major, Month, Day, Year);

      if Minor = -1 then
        Result := Format('%d.xx (cannot determine minor version)', [Major])
      else
        if Minor < 10 then
          Result := Format('%d.0%d', [Major, Minor])
        else
          Result := Format('%d.%d', [Major, Minor]);
    except
    end;
  finally
    DbiExit;
  end;
end;

Thank you for your time to read my email.

Best Regards
leigh

--------- Original Messsage ---------
From: "Wes Edwards" <[EMAIL PROTECTED]>
Sent on:  Mon, 8 May 2000 15:34:26 +1200
-------------------------------------


> Leigh,
> 
> There are TWO version numbers in the BDE.  Note that BDE Admin will report
> the two version numbers in two different places too,  I use the following
> code.
> 
> The relevant part is extracting iIntfLevel from the version info.
> 
> Wes Edwards
> 
> var
>   MyList : TStringList;
>   MySysVersion : SYSVersion;
> begin
>   Result := false;
>   try
>     MyList := TStringList.Create;
>     try
>       Check(dbiInit(nil));
>       Check(DbiGetSysVersion(MySysVersion));
>       Check(dbiExit);
>       if (MyList <> nil) then
>       begin
>         with MyList do
>         begin
>           Clear;
>           Add('Borland Database Engine Initialised OK');
>           Add('');
>           Add('System Information:');
>           Add(Format('Engine Version=%d', [MySysVersion.iVersion]));
>           Add(Format('Interface Level=%d', [MySysVersion.iIntfLevel]));
>         end;
>         Result := true;
>       end;
>     except
>       // cannot initialise BDE
>     end;
>   finally
>     MyList.Free;
>   end;
> end;
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > Behalf Of Leigh Wanstead
> > Sent: Monday, 8 May 2000 15:16
> > To: Multiple recipients of list delphi
> > Subject: [DUG]: Get BDE Version
> >
> >
> > Hello everyone,
> >
> > I use following code to get version of BDE.
> > But it seems not work with BDE5.11.
> >
> > What is wrong with this piece of code?
> >
> > Duplicate procedure:
> > 1) Drop a button on the form
> > 2) Drop a label on the form
> > 3) Link button onclick event with following code
> >
> > procedure TForm1.Button1Click(Sender: TObject);
> > var
> >   BDESYSVersion: SYSVersion;
> >   s: String;
> > begin
> >   if dbiGetSysVersion(BDESYSVersion) = DBIERR_NONE then
> >     s := Format('%f', [BDESYSVersion.iVersion / 100])
> >   else
> >     s := '';
> >   Label1.Caption := s;
> > end;
> >
> > // and result shows 5.00
> >
> > Thanks in advance.
> > I look forward to hearing from you.
> >
> > Best Regards
> > leigh
> >
> > ------------------------------------------------------------------
> > ---------
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> >
> 
> ---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> 
> 

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to