主题:求助:为什么会出错!!
Procedure SaXes;
var
I,Mode: Integer;
stgRoot: IStorage;
stmName: String;
stmData: IStream;
OleStream: TOleStream;
LoadStream: TMemoryStream;
begin
Ent[-1]:=tempPath + PwsFileName;
Mode := STGM_CREATE+STGM_READWRITE+STGM_SHARE_EXCLUSIVE;
StgCreateDocfile(StringToOleStr(EnSaveFilename),
Mode, 0, stgRoot);
LoadStream := TMemoryStream.Create;
for I := -1 to FileK do
begin
stmName := Ent[i];
if FileExists(Ent[i]) then
begin
stgRoot.CreateStream(StringToOleStr(stmName), Mode, 0, 0, stmData);
OleStream := TOleStream.Create(stmData);
LoadStream.LoadFromFile(stmName);
LoadStream.Position := 0;
OleStream.CopyFrom(LoadStream, LoadStream.Size);
OleStream.Free;
End;
end;
LoadStream.Free;
var
I,Mode: Integer;
stgRoot: IStorage;
stmName: String;
stmData: IStream;
OleStream: TOleStream;
LoadStream: TMemoryStream;
begin
Ent[-1]:=tempPath + PwsFileName;
Mode := STGM_CREATE+STGM_READWRITE+STGM_SHARE_EXCLUSIVE;
StgCreateDocfile(StringToOleStr(EnSaveFilename),
Mode, 0, stgRoot);
LoadStream := TMemoryStream.Create;
for I := -1 to FileK do
begin
stmName := Ent[i];
if FileExists(Ent[i]) then
begin
stgRoot.CreateStream(StringToOleStr(stmName), Mode, 0, 0, stmData);
OleStream := TOleStream.Create(stmData);
LoadStream.LoadFromFile(stmName);
LoadStream.Position := 0;
OleStream.CopyFrom(LoadStream, LoadStream.Size);
OleStream.Free;
End;
end;
LoadStream.Free;