1.MessageDlg function
在屏幕中间显示一个消息对话框
Displays a message dialog box in the center of the screen.
function MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons;

HelpCtx: Longint): Word;

type TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);
type
  TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore, mbAll,

mbNoToAll, mbYesToAll, mbHelp);
  TMsgDlgButtons = set of TMsgDlgBtn;
const
  mbYesNoCancel = [mbYes, mbNo, mbCancel];
  mbYesAllNoAllCancel = [mbYes, mbYesToAll, mbNo, mbNoToAll, mbCancel];
  mbOKCancel = [mbOK, mbCancel];
  mbAbortRetryIgnore = [mbAbort, mbRetry, mbIgnore];
  mbAbortIgnore = [mbAbort, mbIgnore];
begin
  if MessageDlg('Welcome to my Object Pascal application.  Exit now?',
    mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  begin
    MessageDlg('Exiting the Object Pascal application.', mtInformation,
      [mbOk], 0);
    Close;
  end;
2.ShowMessage
出现一个含有ok按钮的消息框
Displays a message box with an OK button.
procedure ShowMessage(const Msg: string);
3.MessageBox
为用户显示一个特定的消息
Displays a specified message to the user.
function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK): Integer;
with Application do
  begin
    NormalizeTopMosts;
    MessageBox('This should be on top.', 'Look', MB_OK);
    RestoreTopMosts;
  end;

posted on 2007-04-27 16:21  左左右右  阅读(579)  评论(0编辑  收藏  举报