AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Text and binary in one stream? | Shortcuts?
Thema durchsuchen
Ansicht
Themen-Optionen

Text and binary in one stream? | Shortcuts?

Ein Thema von WojTec · begonnen am 7. Mai 2010 · letzter Beitrag vom 7. Mai 2010
 
WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#1

Text and binary in one stream? | Shortcuts?

  Alt 7. Mai 2010, 12:13
Hello guys!

# begin streams

I need to save and read many data types (numbers (int, float), records, arrays and strings) in one file. Problem is with strings. Currently I'm using TStringStream:

Example write:
Delphi-Quellcode:
Buffer := Length(AValue);
AStream.Write(Buffer, 4);

AString.Clear;
AString.WriteString(AValue);

AStream.CopyFrom(AString, 0);
Example read:
Delphi-Quellcode:
Strings := TStringStream.Create;
try
  P := AStream.Position;
  AStream.Position := 0;
  Strings.CopyFrom(AStream, FHeaderSize);
  AStream.Position := P;

  for I := 1 to 8 do
  begin
    AStream.Position := P;
    AStream.Read(buff32, 4);

    Strings.Position := AStream.Position;
    buffS := Strings.ReadString(buff32);

    // ...

    AStream.Position := Strings.Position;
    P := AStream.Position;
  end;
finally
  Strings.Free;
end;
1st at all strings inside file are not Unicode (compiled on D2010). How to make it unicode?
2nd: my method looks very lame, is better method to store strings next to the binary data?

# end streams

# begin shortcuts

2nd my problem is with shortcuts in dynamically created menu items:

Delphi-Quellcode:
if Item.Tag in [1..9] then
  Item.ShortCut := ShortCut(48 + Item.Tag, [ssCtrl, ssAlt])
;
When press Ctrl+Alt+[num 1-9] program starts executing OnClick for ever... Why?

# end shortcuts
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:47 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