MFC MessageBox 返回值判断

MessageBox will return zero if it fails, or one of:
IDABORT Abort button was selected.
IDCANCEL Cancel button was selected.
IDCONTINUE Continue button was selected.
IDIGNORE Ignore button was selected.
IDNO No button was selected.
IDOK OK button was selected.
IDRETRY Retry button was selected.
IDTRYAGAIN Try Again button was selected.
IDYES Yes button was selected.

代码示例:

...
if(MessageBox(WindowHandleHere, MessageHere, TitleHere, StylesHere) == IDYES) // or IDNO, depending
{

// If the user clicks yes...

}

exp2:

if (IDYES == ::MessageBox(AfxGetMainWnd()->m_hWnd, "保存路径不存在,是否需要创建?","系统提示",MB_ICONEXCLAMATION|MB_YESNO ))
     {
      ……

     }

你可能感兴趣的:(vc++)