大虾们:请问在使用AfxMessageBox()时,如何设置提示框的标题,还有,该提示框的肯定、否定及
取消的编程接口在什么地方?不胜感谢!

解决方案 »

  1.   

    AfxMessageBox("GetAdaptersInfo() failed","Warning",MB_OK|MB_ICONWARNING);
      

  2.   

    非要用AfxMessageBox吗?要是可以用MessageBox()的话,楼上的倒是可以!!
    MessageBox("GetAdaptersInfo() failed","Warning",MB_YESNOCANCEL|MB_ICONWARNING);
      

  3.   

    int n= MessageBox("","",MB_YESNOCANCEL|MB_ICONWARNING;
    if(n == ID_YES)
             //^^^^^^^^^^^^^^^^^^^^   else if( n == IDNO)
             //    else 
            //
      

  4.   

    MB_OK|MB_ICONWARNING...只对MessageBox有用
      

  5.   

    AfxMessageBox 
    int AfxMessageBox( LPCTSTR lpszText, UINT nType = MB_OK, UINT nIDHelp = 0 );int AFXAPI AfxMessageBox( UINT nIDPrompt, UINT nType = MB_OK, UINT nIDHelp = (UINT) -1 );Return ValueZero if there is not enough memory to display the message box; otherwise one of the following values is returned: IDABORT   The Abort button was selected.
    IDCANCEL   The Cancel button was selected.
    IDIGNORE   The Ignore button was selected.
    IDNO   The No button was selected.
    IDOK   The OK button was selected.
    IDRETRY   The Retry button was selected.
    IDYES   The Yes button was selected. 
    If a message box has a Cancel button, the IDCANCEL value will be returned if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing the ESC key has no effect.The functions AfxFormatString1 and AfxFormatString2 can be useful in formatting text that appears in a message box.ParameterslpszTextPoints to a CString object or null-terminated string containing the message to be displayed in the message box.nTypeThe style of the message box. Apply any of the message-box styles to the box.  nIDHelpThe Help-context ID for the message; 0 indicates the application’s default Help context will be used.nIDPromptA unique ID used to reference a string in the string table.ResDisplays a message box on the screen. The first form of this overloaded function displays a text string pointed to by lpszText in the message box and uses nIDHelp to describe a Help context. The Help context is used to jump to an associated Help topic when the user presses the Help key (typically F1).The second form of the function uses the string resource with the ID nIDPrompt to display a message in the message box. The associated Help page is found through the value of nIDHelp. If the default value of nIDHelp is used (– 1), the string resource ID, nIDPrompt, is used for the Help context. For more information about defining Help contexts, see the articleHelp Topics in Visual C++ Programmer’s Guide and Technical Note 28.  Message-Box Styles
    Message_Box Types MB_ABORTRETRYIGNORE   The message box contains three pushbuttons: Abort, Retry, and Ignore.MB_OK   The message box contains one pushbutton: OK.MB_OKCANCEL   The message box contains two pushbuttons: OK and Cancel.MB_RETRYCANCEL   The message box contains two pushbuttons: Retry and Cancel.MB_YESNO   The message box contains two pushbuttons: Yes and No.MB_YESNOCANCEL   The message box contains three pushbuttons: Yes, No, and Cancel. 
    Message-Box Modality MB_APPLMODAL   The user must respond to the message box before continuing work in the current window. However, the user can move to the windows of other applications and work in those windows. The default is MB_APPLMODAL if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.MB_SYSTEMMODAL   All applications are suspended until the user responds to the message box. System-modal message boxes are used to notify the user of serious, potentially damaging errors that require immediate attention and should be used sparingly.MB_TASKMODAL   Similar to MB_APPLMODAL, but not useful within a Microsoft Foundation class application. This flag is reserved for a calling application or library that does not have a window handle available. 
    Message-Box Icons MB_ICONEXCLAMATION   An exclamation-point icon appears in the message box.MB_ICONINFORMATION   An icon consisting of an “i” in a circle appears in the message box.MB_ICONQUESTION   A question- icon appears in the message box.MB_ICONSTOP   A stop-sign icon appears in the message box. 
    Message-Box Default Buttons MB_DEFBUTTON1   The first button is the default. Note that the first button is always the default unless MB_DEFBUTTON2 or MB_DEFBUTTON3 is specified.MB_DEFBUTTON2   The second button is the default.MB_DEFBUTTON3   The third button is the default.