Study Note of use of MessageBox() and its surrounding information(MFC)

来源:互联网 发布:数字音频矩阵 品牌 编辑:程序博客网 时间:2024/04/29 21:15

    The MessageBox function has three arguments,first points to the information shown to the user, second one relates to the title(optional), last one specifies the types of buttons and icon on the dialog window. The detailed information is as follows:

MESSAGEBOX BUTTON COMBINATION IDS.

ID Buttons MB_ABORTRETRYIGNORE Abort, Retry, Ignore MB_OK OK MB_OKCANCEL OK, Cancel MB_RETRYCANCEL Retry, Cancel MB_YESNO Yes, No MB_YESNOCANCEL Yes, No, Cancel

MESSAGEBOX ICON IDS.

ID Icon MB_ICONINFORMATION Informational icon MB_ICONQUESTION Question mark icon MB_ICONSTOP Stop sign icon MB_ICONEXCLAMATION Exclamation mark icon

MESSAGEBOX RETURN VALUE IDS.

ID Button Clicked IDABORT Abort IDRETRY Retry IDIGNORE Ignore IDYES Yes IDNO No IDOK OK

IDCANCEL
Cancel

 

Example:

void CDialogsDlg::OnButton1()
{
 // TODO: Add your control notification handler code here
 if (MessageBox("您好!","标题?",MB_YESNOCANCEL|MB_ICONQUESTION)==IDYES)
  MessageBox("ok");
}