执行messagedlg,点确定后为什么不执行begin end间的内容?该怎么处理

执行messagedlg,点确定后为什么不执行beginend间的内容?ifMessageDlg( WelcometomyDelphiapplication.Exit

执行messagedlg,点确定后为什么不执行begin end间的内容?
if   MessageDlg( 'Welcome   to   my   Delphi   application.     Exit   now? ',
        mtConfirmation,   [mbYes,   mbNo],   0,   mbYes)   =   mrYes   then
    begin
        MessageDlg( 'Exiting   the   Delphi   application. ',   mtInformation,
            [mbOk],   0,   mbOk);
        Close;
    end;

在执行这段代码时,点击确定为什么不执行   begin     end间的哪个MessageDlg()语句?

[解决办法]
改成:
if MessageDlg( 'Welcome to my Delphi application. Exit now? ',
mtConfirmation, [mbYes, mbNo], 0, mbYes) = ord(mbYes) then
begin
MessageDlg( 'Exiting the Delphi application. ', mtInformation,
[mbOk], 0, mbOk);
Close;
end;