3:关闭事件
[code:1]var
ReturnBtn: TMessagebutton;
begin
if memo.modified then
begin
returnbtn := application.messagebox('File has..','warning',[smbYes,smbNo,smbCancel],smswarning,smbYes,smbCancel);
if returnbtn = smbYes then
begin
mnuitmfilesaveclick(sender);
...[/code:1]
7:
[code:1]var
ReturnBtn: Integer;
begin
if RichEdit1.Modified then
begin
ReturnBtn := MessageDlg('File has been modified.Save it now?',
mtConfirmation, [mbYes, mbNo,mbCancel], 0);
if ReturnBtn =mrYes then
begin
FileSaveExecute(Sender);
exit;
end;
if ReturnBtn = mrNo then
begin
Exit;
end;
if ReturnBtn = mrCancel then
begin
CanClose :=false;
end;[/code:1]