if messageDlg('你确定退出?',mtInformation,[mbYes,mbNo],0) = mrYes then Application.Terminate;
Displays a message dialog box in the center of the screen.
Unit Dialogs Syntax [Delphi] function MessageDlg(const Msg: string, DlgType: TMsgDlgType, Buttons: TMsgDlgButtons, HelpCtx: Integer): Integer; Description Call MessageDlg to bring up a message box and obtain the user's response. Caption specifies the caption for the message box when DlgType is mtCustom. If this parameter is not used, the caption for custom message boxes is the title of the application.
Msg is the content of the message that appears.
DlgType indicates the purpose of the dialog.
Buttons indicates what buttons should appear in the message box. For a three button message box, use the syntax containing Button1, Button2, and Button3.
Button1, Button2, and Button3 indicate what types of buttons to use for a three button message box. The resulting buttons appear in order.
HelpCtx specifies the context ID for the help topic that should appear when the user clicks the help button or presses F1 while the dialog is displayed.
X and Y specify the screen coordinates where the dialog should appear. A value of –1 means that the message box can appear anywhere in the specified dimension.
DefaultBtn specifies which button from among those specified by Buttons (or Button1, Button2, and Button3) is the default button for the dialog. If DefaultBtn is mbNone, there is no default button.
Bitmap is an image that appears on the face of the message dialog. If Bitmap is nil (Delphi) or NULL (C++), there is no image unless DlgType is mtConfirmation.
MessageDlg returns the value of the button the user selected. The following table lists the TMsgDlgBtn values for each type of button that can appear in the message box, and the corresponding value that is returned if the user selects that button: TMsgDlgBtn Value Corresponding return value mbOk mrOk
mbOK mrOk
mbCancel mrCancel
mbYes mrYes
mbNo mrNo
mbAbort mrAbort
mbRetry mrRetry
mbIgnore mrIgnore
mbAll mrAll
mbNoToAll mrNoToAll
mbYesToAll mrYesToAll Note: If the user types Ctrl+C in the message box, the text of the message is copied to the clipboard.
Application.Terminate;
Unit
Dialogs Syntax
[Delphi] function MessageDlg(const Msg: string, DlgType: TMsgDlgType, Buttons: TMsgDlgButtons, HelpCtx: Integer): Integer;
Description
Call MessageDlg to bring up a message box and obtain the user's response.
Caption specifies the caption for the message box when DlgType is mtCustom. If this parameter is not used, the caption for custom message boxes is the title of the application.
Msg is the content of the message that appears.
DlgType indicates the purpose of the dialog.
Buttons indicates what buttons should appear in the message box. For a three button message box, use the syntax containing Button1, Button2, and Button3.
Button1, Button2, and Button3 indicate what types of buttons to use for a three button message box. The resulting buttons appear in order.
HelpCtx specifies the context ID for the help topic that should appear when the user clicks the help button or presses F1 while the dialog is displayed.
X and Y specify the screen coordinates where the dialog should appear. A value of –1 means that the message box can appear anywhere in the specified dimension.
DefaultBtn specifies which button from among those specified by Buttons (or Button1, Button2, and Button3) is the default button for the dialog. If DefaultBtn is mbNone, there is no default button.
Bitmap is an image that appears on the face of the message dialog. If Bitmap is nil (Delphi) or NULL (C++), there is no image unless DlgType is mtConfirmation.
MessageDlg returns the value of the button the user selected. The following table lists the TMsgDlgBtn values for each type of button that can appear in the message box, and the corresponding value that is returned if the user selects that button:
TMsgDlgBtn Value Corresponding return value
mbOk
mrOk
mbOK
mrOk
mbCancel
mrCancel
mbYes
mrYes
mbNo
mrNo
mbAbort
mrAbort
mbRetry
mrRetry
mbIgnore
mrIgnore
mbAll
mrAll
mbNoToAll
mrNoToAll
mbYesToAll
mrYesToAll
Note: If the user types Ctrl+C in the message box, the text of the message is copied to the clipboard.
估计你就知道copy