Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Delphi [Gelöst] BASS_GetVersion: Wie auslesen? (https://www.delphipraxis.net/183122-%5Bgeloest%5D-bass_getversion-wie-auslesen.html)

hathor 12. Dez 2014 16:33


[Gelöst] BASS_GetVersion: Wie auslesen?
 
Die übliche Art des Auslesens ist:

Delphi-Quellcode:
Label1.Caption:= ' BASS.DLL-Version: '+INTTOSTR(LOWORD(BASS_GetVersion))+'.'
 + INTTOSTR(HIWORD(BASS_GetVersion));
Das funktioniert aber nur, wenn die Version z.B. 2.4 ist.

Ist die Version aber 2.4.10, dann geht das nicht.

Eine Behelfskonstruktion ist folgende:

Delphi-Quellcode:
var hstr, S1, S2, S3 : String;
begin
  hstr:= IntToHex(BASS_GetVersion div 256, 6);
  S1:= INTTOSTR(STRTOINT('$'+copy(hstr,1,2)));
  S2:= INTTOSTR(STRTOINT('$'+copy(hstr,3,2)));
  S3:= INTTOSTR(STRTOINT('$'+copy(hstr,5,2)));
  Label1.Caption:= ' BASS.DLL-Version: '+S1+'.'+S2+'.'+S3;
Geht das einfacher?

Nachtrag: Lösung gefunden:

Delphi-Quellcode:
function GetVersion(BASSversion: DWord): string;
begin
Result := Format('%d.%d.%d', [
BASSversion shr 24 and $ff,
BASSversion shr 16 and $ff,
BASSversion shr 8 and $ff]);
end;
...
  Label11.Caption:= ' BASS.DLL-Version: '+ GetVersion(BASS_GetVersion);
...


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:30 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz