改一下,就行了if MessageDlg('还有未保存文件,是否关闭?',mtWarning,[mbYes,mbNo],0)=6 idyes thenCanClose:=trueelseCanClose:=false;