请您用以上函数显示一个Yes/no的选择对话框(同时最好有个问号出现)
接下去根据选择,分别执行不同的代码。类似:if (IDOK==dlg.DoModal()) {}
       else {}  
可是用MessageBox这样写,我不会。
请指教,多谢!

解决方案 »

  1.   

    if (MessageBox("How do you do?","Hello",MB_YESNO)==IDOK)
      {
        //你按了YES
             }
    else
    {
     //你按了No
     }AfxMessageBox("How do you do?","Hello",MB_YESNO | MB_ICONQUESTION   )
      

  2.   

    if(MessageBox("HELLO", "Title", MB_OKCANCEL) == IDOK)
    {}
    else
    {}
      

  3.   

    AfxMessageBox(GetSafeHwnd(),"How do you do?","Hello",MB_YESNO | MB_ICONQUESTION   )
      

  4.   

    主要是MessageBox 有的地方不能用,只好用AfxMessageBox了
      

  5.   

    int MessageBox(
      HWND hWnd,          // handle to owner window
      LPCTSTR lpText,     // text in message box
      LPCTSTR lpCaption,  // message box title
      UINT uType          // message box style
    );
    Parameters
    hWnd 
    [in] Handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window. 
    lpText 
    [in] Pointer to a null-terminated string that contains the message to be displayed. 
    lpCaption 
    [in] Pointer to a null-terminated string that contains the dialog box title. If this parameter is NULL, the default title Error is used. 
    uType 
    [in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags. 
    To indicate the buttons displayed in the message box, specify one of the following values. Value Meaning 
    MB_ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry, and Ignore. 
    MB_CANCELTRYCONTINUE Windows 2000/XP: The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE. 
    MB_HELP Windows 95/98/Me, Windows NT 4.0 and later: Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner. 
    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. To display an icon in the message box, specify one of the following values. Value Meaning 
    MB_ICONEXCLAMATION, 
    MB_ICONWARNING An exclamation-point icon appears in the message box. 
    MB_ICONINFORMATION, MB_ICONASTERISK An icon consisting of a lowercase letter i in a circle appears in the message box. 
    MB_ICONQUESTION A question- icon appears in the message box. 
    MB_ICONSTOP, 
    MB_ICONERROR, 
    MB_ICONHAND A stop-sign icon appears in the message box. To indicate the default button, specify one of the following values. Value Meaning 
    MB_DEFBUTTON1 The first button is the default button. 
    MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
     
    MB_DEFBUTTON2 The second button is the default button. 
    MB_DEFBUTTON3 The third button is the default button. 
    MB_DEFBUTTON4 The fourth button is the default button. 
      

  6.   

    if(AfxMessageBox(strMessage,MB_OKCANCEL|MB_ICONQUESTION)==IDOK)
    {
       }
    else
    {
      }
    MessageBox用法同理。(只不过还多一个标题参数)
    通过它们的返回值来判断