C
ChJK
Unregistered / Unconfirmed
GUEST, unregistred user!
如何把Tlist保存为数据流或文件,并可以从数据流或文件中读出数据到Tlist
这是我写的部分代码
type
PClips = ^TClips;
TClips = record
cf: Word;
buf: Pointer;
size: Cardinal;
end;
{把Tlist保存成文件,不知道对不对,请指教}
procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
blk: PClips;
lipList: TList;
ms: TMemoryStream;
begin
ClipList := TList.Create;
ms := TMemoryStream.Create;
for i := 0 to Clipboard.FormatCount - 1 do
begin
New(blk);
blk.cf := Clipboard.Formats;
GetClippedData(blk.cf, blk.buf, blk.size);
ClipList.Add(blk);
ms.Write(PClips(ClipList.Items^ ), SizeOf(PClips));
end;
ms.SaveToFile('c:/test.dat');
ms.Free;
end;
{把文件内容保存到Tlist,有问题就不贴出来了}
先谢谢各位兄弟了
这是我写的部分代码
type
PClips = ^TClips;
TClips = record
cf: Word;
buf: Pointer;
size: Cardinal;
end;
{把Tlist保存成文件,不知道对不对,请指教}
procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
blk: PClips;
lipList: TList;
ms: TMemoryStream;
begin
ClipList := TList.Create;
ms := TMemoryStream.Create;
for i := 0 to Clipboard.FormatCount - 1 do
begin
New(blk);
blk.cf := Clipboard.Formats;
GetClippedData(blk.cf, blk.buf, blk.size);
ClipList.Add(blk);
ms.Write(PClips(ClipList.Items^ ), SizeOf(PClips));
end;
ms.SaveToFile('c:/test.dat');
ms.Free;
end;
{把文件内容保存到Tlist,有问题就不贴出来了}
先谢谢各位兄弟了