很简单的Delphi程序,可是不能运行,不知道错在哪里了

很简单的Delphi程序,可是不能运行,不知道错在哪里了,第1张

分类: 电脑/网络 >>程序设计 >>其他编程语言

问题描述:

这是一个测试d出对话框的小程序,用到了这个函数“function MessageDlg(const Msg: stringDlgType: TMsgDlgTypeButtons: MsgDlgButtonsHelpCtx: Longint): Integer”可是在编译的时候却不能运行基仿,Delphi报错: ':=' expected but '=' found。不知道该怎搏颂纤么改,麻烦大家看看:

unit Unit1

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls

type

TForm1 = class(TForm)

Button1: TButton

procedure Button1Click(Sender: TObject)

private

{ Private declarations }

public

{ Public declarations }

end

var

Form1: TForm1

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject)

begin

if MessageDlg('你要离开系统吗?樱薯',mtconfirmation,[mbYes,mbNo],0)=mrYes then

begin

MessageDlg('系统关闭中',mtInformation,[mbOK],0)=mrOK then

Close

end

end.

解析:

procedure TForm1.Button1Click(Sender: TObject)

begin

if MessageDlg('你要离开系统吗?',mtconfirmation,[mbYes,mbNo],0)=mrYes then

begin

if MessageDlg('系统关闭中',mtInformation,[mbOK],0)=mrOK then

Close

end

end

掉了一个if和end

还有已经给了提示了':=' expected but '=' found

期望是:=,但是找到的是=

1.启动Delphi;

2. open project,选择 *.dpr 文件打开;

3.按下 F9;

4. 进入你的工程目录,查找闭稿皮那个 *.exe 文件

5.收敬尺工轿差。

试一下这个脊差

关闭数据执唤伏行保护 或添加delphi32.exe为DEP的特例。和野携

具体方法视你的 *** 作系统而定。 以Windows 7为例。 我的电脑-右键属性-高级系统设置-高级-性能设置-数据执行保护-添加


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12275138.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-22
下一篇2023-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存