Y
yaoluo
Unregistered / Unconfirmed
GUEST, unregistred user!
f1book中writetoBlob 和readFromBlob的用法
从网上找了一段代码,但生成的文件总是 4096字节,并且是“无效文件”
procedure TForm1.Button1Click(Sender: TObject);
var
Stream: TMemoryStream;
MyBlob: HGlobal;
pblob: Pointer;
begin
F1Book.SaveWindowInfo;
MyBlob := GlobalAlloc(GMEM_MOVEABLE, 2000);
try
showmessage(InttoStr(GlobalSize(myBlob)));
F1Book.WriteToBlob(MyBlob, 0);
pBlob := globalLock(MyBlob);
showmessage(InttoStr(GlobalSize(myBlob)));
try
stream := TMemoryStream.Create;
try
stream.Write(pBlob^, GlobalSize(myBlob));
Stream.SaveToFile('e:/tmp.vts');
finally
stream.Free;
end;
finally
globalUnlock(MyBlob);
end;
finally
globalFree(myblob);
end;
end;
从网上找了一段代码,但生成的文件总是 4096字节,并且是“无效文件”
procedure TForm1.Button1Click(Sender: TObject);
var
Stream: TMemoryStream;
MyBlob: HGlobal;
pblob: Pointer;
begin
F1Book.SaveWindowInfo;
MyBlob := GlobalAlloc(GMEM_MOVEABLE, 2000);
try
showmessage(InttoStr(GlobalSize(myBlob)));
F1Book.WriteToBlob(MyBlob, 0);
pBlob := globalLock(MyBlob);
showmessage(InttoStr(GlobalSize(myBlob)));
try
stream := TMemoryStream.Create;
try
stream.Write(pBlob^, GlobalSize(myBlob));
Stream.SaveToFile('e:/tmp.vts');
finally
stream.Free;
end;
finally
globalUnlock(MyBlob);
end;
finally
globalFree(myblob);
end;
end;