Board index » delphi » Converting Bin value to String

Converting Bin value to String

Hi!
I want to convert a binary value from a registry key to a string value to
use in my application. Does anybody knows how to do this?
Thanks,
Ulrich
 

Re:Converting Bin value to String


Quote
> I want to convert a binary value from a registry key to a string value to
> use in my application. Does anybody knows how to do this?

... 128 64 32 16 8 4 2 1
if  it`s for example 00011000 -> 24 (as integer (use inttostr for converting
to string))

Stefan

(msstet ihr bei sap nicht sowas k?nnen ? :-) )

Re:Converting Bin value to String


Tja unsere Entwickler werden das schon k?nnen (nur programmieren die
bestimmt nicht in Delphi), fr mich ist das nur Hobby....Aber trotzdem
Danke... Das ganze sieht jedoch so aus:
Ich habe einen Eintrag in der Registry (SlowInfoCache), der als BIN- Value
abgelegt ist. Ich habe folgende Routine gebaut:
....
const
  Key  : String = '\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Management\ARPCache\Delphi5';
  Val  : String = 'SlowInfoCache';
 var
  Data : Array of Byte; // Dynamic Array - Delphi4 Only !!
  S    : String;
  sz   : Word;
  I    : Word;
  R    : TRegistry;
 begin
  R := TRegistry.Create;
  with R do
   begin
     RootKey := HKEY_LOCAL_MACHINE;
     OpenKey(Key, False);
    if GetDataType(Val) = rdBinary
     then
      begin
       sz := GetDataSize(Val);
       if sz > 0 then
        begin
         SetLength(Data, sz);
         ReadBinaryData(Val, Data[0], sz);
         S := Val + ' = ';
         for I := 0 to sz - 1 do
          begin
           S := S + Format('%2x',[Data[I]]);
          end;
......
Als Ergebnis erhalte ich nun:
8 2 0 0 1 0 0 0 080E8 9 0 0 0 0D09B1539 7C7C0 1 9 0 0 043 03A 05C 050 072
06F 067 072 061 06D 020 046 069 06C 065 073 05C 042 06F 072 06C 061 06E 064
05C 044 065 06C 070 068 069 035 05C 048 065 06C 070 05C 054 06F 06F 06C 073
05C 068 063 077 02E 065 078 065 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Tja, da ich ja wie oben bemerkt kein Profi bin, stellt sich mir jetzt die
Frage, wie ich den Text herausbekomme....Der Text sollte einen Programmpfad
enthalten...

Gruss,
Ulrich

Quote
"Stefan Nowy" <ste...@nowy.de> wrote in message

news:3ADD73ED.EC92A88E@nowy.de...
Quote
> > I want to convert a binary value from a registry key to a string value
to
> > use in my application. Does anybody knows how to do this?

> ... 128 64 32 16 8 4 2 1
> if  it`s for example 00011000 -> 24 (as integer (use inttostr for
converting
> to string))

> Stefan

> (msstet ihr bei sap nicht sowas k?nnen ? :-) )

Other Threads