标题:看源程序时碰到的问题
取消只看楼主
melong
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-3-30
 问题点数:0 回复次数:0 
看源程序时碰到的问题

procedure TsampleForm.OpenDOCClick(Sender: TObject);
var
MemSize: Integer;
Buffer: PChar;
MyFile: TFileStream;
Stream: TBlobStream;
begin
OpenDialog1.Filter:='WORD文档(*.DOC)|*.DOC';{从对话窗选择文件}
if OpenDialog1.Execute then
begin
MyFile:=TFileStream.Create(OpenDialog1.FileName,fmOpenRead);
with table1 do {table1’为含BLOB字段的表名}
begin
Open;
Edit;
Stream := TBlobStream.Create(FieldByName('Doc') as TBlobField,
bmWrite);{Doc’为BLOB字段名}
MemSize := MyFile.Size;
Inc(MemSize); {Make room for the buffer's null terminator.}
Buffer := AllocMem(MemSize); {Allocate the memory.}
try
Stream.Seek(0, soFromBeginning); {Seek 0 bytes from the stream's
end point}
MyFile.Read(Buffer^,MemSize);
Stream.Write(Buffer^,MemSize);
finally
MyFile.Free;
Stream.Free;
end;
try
Post;
except
on E: EDatabaseError do
if HandelException(E)< >0 then
exit
else
raise;
end;
end;
Doc_ole.CreateObjectFromFile(OpenDialog1.FileName,False);
Doc_ole.Run;{Doc_oleToleContainer构件名}
end;
end;

###################
HandelException(E)< >0在这段代码中是什么意思呢?

[此贴子已经被作者于2006-4-10 23:21:25编辑过]

搜索更多相关主题的帖子: face procedure 源程序 style 
2006-04-09 23:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-56411-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.150552 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved