+ -
当前位置:首页 → 问答吧 → 代码哪里出错(简单)??

代码哪里出错(简单)??

时间:2011-10-12

来源:互联网

procedure Hello;
begin
  MessageDlg('Hello World!', mtInformation, [mbOK]);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Hello;
end;

作者: L3nnon   发布时间: 2011-10-12

什么错误信息

作者: hongss   发布时间: 2011-10-12

procedure Hello;
begin
  MessageDlg('Hello World!', mtInformation, [mbOK],0);
end;

作者: tj_snowwolf   发布时间: 2011-10-12

引用 1 楼 hongss 的回复:

什么错误信息

[DCC Error] Unit1.pas(28): E2250 There is no overloaded version of 'MessageDlg' that can be called with these arguments

[DCC Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas'

作者: L3nnon   发布时间: 2011-10-12

procedure Hello;
begin
  MessageDlg('Hello World!', mtInformation, [mbOK], 0);
end;

四个参数 2楼的对

作者: ADSLAN   发布时间: 2011-10-12

引用 2 楼 tj_snowwolf 的回复:

procedure Hello;
begin
MessageDlg('Hello World!', mtInformation, [mbOK],0);
end;

引用 “Delphi精要”
现在回到我前面提到过的代码封装概念。当你调用Double 函数时,你不需要知道该函数的具体实现方法。如果以后发现了更好的双倍数计算方法,你只需要改变函数的代码,而调用函数的代码不必改变(尽管代码执行速度可能会加快!)。Hello 过程也一样,你可以通过改变这个过程的代码,修改程序的输出,Button2Click 方法会自动改变显示结果。下面是改变后的代码:

procedure Hello;
begin
MessageDlg ('Hello world!', mtInformation, [mbOK]);
end;

为什么“Delphi精要”里没有提到 0??
0 有什么功用??

作者: L3nnon   发布时间: 2011-10-12

函数原型:function MessageDlg(const Msg: string; DlgType: TMsgDlgType;
  Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;

下次,遇到不熟的方法或函数,在代码编辑器里,按着ctrl键、用鼠标点击函数名,就可以找到出处,便知道具体参数数量及类型了。

作者: gzzai   发布时间: 2011-10-12