[英]Issue of using outlook2000 unit in Delphi
Am trying to use the unit 'outlook2000' but something wrong happned to my Try statements and I get Error: E2021 Class type required .我正在尝试使用单位“outlook2000”,但我的Try 语句出现问题,我得到Error: E2021 Class type required 。 if I excuted my app without this unit or without Except then everything is fine.
如果我在没有这个单元或没有例外的情况下执行了我的应用程序,那么一切都很好。
Uses ...,outlook2000;
procedure TForm1.Button1Click(Sender: TObject);
var
S:string;
begin
try
s:='Hello';
Except On E:Exception do
ShowMessage(E.Message);
end;
end;
Can anyboady explains what is the wrong.任何人都可以解释什么是错的。 Am using Delphi 10.1 Berlin, Win 10.
我正在使用 Delphi 10.1 Berlin,Win 10。
The only reason I know this is because just the other day this baffled me as well with a similar situation.我知道这一点的唯一原因是,就在前几天,这也让我对类似的情况感到困惑。
Change your Except On:Exception
to except on E:System.SysUtils.Exception
.将您的
Except On:Exception
更改为except on E:System.SysUtils.Exception
。 It's because the outlook2000 unit also has an interface called Exception
but we're looking for the object declared in SysUtils
.这是因为 outlook2000 单元也有一个名为
Exception
的接口,但我们正在寻找在 SysUtils 中声明的SysUtils
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.