(6)Me根本不懂OOP:真累啊!!!!(30分)

  • 主题发起人 千中元
  • 开始时间

千中元

Unregistered / Unconfirmed
GUEST, unregistred user!
技术内幕 P129
------我分特,一天读一页!
1) procedure tqueryThread.Execute
begin
.......
......
2) FQueryException:=Exceptobject as Exception;
3) Synchronize(ShowqryError);
end;
4) Procedure TQueryThread.ShowQryError;
5) begin
6) Application.ShowException(FQueryException);
7) end;
问题:
1。请看第一行:好象这个过程从来没有显式的调用过!
2。请看第二行:Exceptobject 是一个函数,函数的调用有这样的形式?(As)...函数的参数是怎么给出的?
3。请看第三行:synchronize 是线程中调用访问到vcL的方法,ShowQryError 访问到VCL?
3。请看第六行:
ExceptAddr参数呢?
定义是: procedure ShowException(ExceptObject: TObject;
ExceptAddr: Pointer)
4。再看第六行:
这里Application的概念。。。关于Application的方法,属性在那里查找?好象帮助里没有呢?
不到大富翁,不知道自己菜。。

 
1.不是有resume吗(你的上一问题),resume后就执行Execute
2-4.我先看看
 
应该是2-5,我饿昏头了。。呵呵。
等会来看。
 
2.Exceptobject函数的返回类型我想是TObject,这句是不是相当于:
AObject:=Exceptobject;

FQueryException:=AObject as Exception;
3.是因为 Application.ShowException(FQueryException),Application可有许多VCL元件
3.TApplication的方法 ShowException(E: Exception)
4.Application是全局变量,类名是TApplication。TApplication帮助中也找不到吗?
 
找到找到
Note: Calling ShowException is rarely necessary in a Delphi application, since the default VCL exception handler calls ShowException automatically.
为什么Charlie他老人家要在这里调用?卖弄风情么?
 
1.对于一个线程类用不着显示调用Execute
如有 QueryThread1.Create(false) 则表明该线程是非挂起式创建,
即立刻启动Execute方法, 若参数是true,则先挂起,待到调用Resume时启动
2.同kang,这句是把ExceptionObject的返回值As的
 
4, 有的, 敲 application. 就出来了,
2, as 是类型转换,一般先判断后才用 as,
也就是 if aObject is TanotherClass then
(aObject as TanotherClass).xx := xx;
我一般判断后用 TAnotherClass(aObject).xx := ..
 
alling ShowException is rarely necessary in a Delphi application,
这里不用不行?
 
可能为说明Synchronize而用的。
我没看过这本书,只说这些。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
564
import
I
顶部