求助:
当我单击 button1 ,希望提示我是否真的运行下面的程序,如果我选择 是,则运行,选择否,则退出。各位大哥这要怎么写啊?procedure TForm1.Button1Click(Sender: TObject);
beginend;谢谢!
当我单击 button1 ,希望提示我是否真的运行下面的程序,如果我选择 是,则运行,选择否,则退出。各位大哥这要怎么写啊?procedure TForm1.Button1Click(Sender: TObject);
beginend;谢谢!
begin
if Application.MessageBox('真的要运行吗?', '提示信息', MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON2) <> IDYES then
Application.Terminate;
end;
begin
if Application.MessageBox('是否真的运行下面的程序', '提示', MB_YESNO + MB_ICONQUESTION)=IDYES then
begin
end
else
begin
end;
end;
MB_OK The message box contains one push button: OK. This is the default.
MB_OKCANCEL The message box contains two push buttons: OK and Cancel.
MB_RETRYCANCEL The message box contains two push buttons: Retry and Cancel.
MB_YESNO The message box contains two push buttons: Yes and No.
MB_YESNOCANCEL The message box contains three push buttons: Yes, No, and Cancel.MessageBox returns 0 if there isn抰 enough memory to create the message box. Otherwise it returns one of the following values:Value Numeric value MeaningIDOK 1 The user chose the OK button.
IDCANCEL 2 The user chose the Cancel button.
IDABORT 3 The user chose the Abort button.
IDRETRY 4 The user chose the Retry button.
IDIGNORE 5 The user chose the Ignore button.
IDYES 6 The user chose the Yes button.
IDNO 7 The user chose the No button.
var
tempstring:string;
begin
tempstring:='是否真的运行下面的程序';
if messagedlg(tempstring,mtwarning,[mbyes,mbno],0)=mryes then
application.Run
else
application.terminate;
end;