Unit CWinapp
……
type
TWinApp = class(TApplication)
private public
Function MsgBox(Text,Caption:string): Integer;
end;implementationFunction TWinApp.MsgBox(Text,Caption:string): Integer;
begin
Result:=messagebox(PChar(Text),PChar(Caption)); //为什么这里可以呢?
end;在Unit 1 中引用 CWinapp
什么不能直接使用 MsgBox 呢?
procedure TForm1.Button1Click(Sender: TObject);
var
Winapp:TWinApp;
begin
Winapp:=TWinApp.Create(self);
Winapp.MsgBox('Delphi IS GOODS Boy!','Capiton'); //可以
MsgBox('Delphi IS GOODS Boy!','Capiton'); //不可以
end;
……
type
TWinApp = class(TApplication)
private public
Function MsgBox(Text,Caption:string): Integer;
end;implementationFunction TWinApp.MsgBox(Text,Caption:string): Integer;
begin
Result:=messagebox(PChar(Text),PChar(Caption)); //为什么这里可以呢?
end;在Unit 1 中引用 CWinapp
什么不能直接使用 MsgBox 呢?
procedure TForm1.Button1Click(Sender: TObject);
var
Winapp:TWinApp;
begin
Winapp:=TWinApp.Create(self);
Winapp.MsgBox('Delphi IS GOODS Boy!','Capiton'); //可以
MsgBox('Delphi IS GOODS Boy!','Capiton'); //不可以
end;
解决方案 »
- RAVE报表中怎样加入页码?
- 为什么要关闭两次才能将数据库里的数据删除?
- 关于系统结构的问题(分不够再给)
- 借问一下:大型数据库(interbase、oracle等)与小型数据库(dbase、paradox等)主要区别在哪儿?
- 已经EOF了,为什么还能取得字段值?
- 超时过期的问题
- file not found "Proxies.dcu"问题完美解决方案
- richedit的出现如下错误richedit line insertion error?
- 我怀疑我的思维不适合写程序
- 绝妙好文,与编程无关!!
- 如何动态将查询结果复给FastReport??????????????[?][?][?]
- 有没有好点的网络书店
又是begian又是end的
不喜欢{}多好
=============================================================
msgbox不是系统函数,不能直接使用啊,要加对象名的,可以用with语句
MsgBox('Delphi IS GOODS Boy!','Capiton1'); //不可以
"房子"↑搭好了、只有"主人"↓才能住呀! 呵呵~~~
var Winapp:TWinApp;
var
bt:TButton;
begin
bt:TButton.Create(self);
bt.Caption:='aaa'; //可以
Caption:='aaa'; //当然不可以了
end;
Application是在哪里定义的?
messagebox 是系统函数吗?