MessageBox、AfxMessageBox、::MessageBox三者功能和区别小结

1、CWnd::MessageBox
int MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );
Return Value
Specifies the outcome of the function. It is 0 if there is not enough memory to create the message box.
Parameters
lpszText lpText和lpszText为消息框的内容。
Points to a CString object or null-terminated string containing the message to be displayed.
lpszCaption lpCaption和lpszCaption为消息框的标题。
Points to a CString object or null-terminated string to be used for the message-box caption. If lpszCaption is NULL, the default caption “Error” is used.
nType uType和nType指定一个决定对话框的内容和行为(按钮、图标、形态及其他)的位标志集。
Specifies the contents and behavior of the message box.
Remarks
Creates and displays a window that contains an application-supplied message and caption, plus a combination of the predefined icons and pushbuttons described in the Message-Box Styles list. Use the global function AfxMessageBox instead of this member function to implement a message box in your application.
The following shows the various system icons that can be used in a message box:

MB_ICONHAND, MB_ICONSTOP, and MB_ICONERROR

MB_ICONQUESTION

MB_ICONEXCLAMATION and MB_ICONWARNING

MB_ICONASTERISK and MB_ICONINFORMATION
这里写图片描述
2、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 Value 返回值
Zero if there is not enough memory to display the message box; otherwise one of the following values is returned:
• IDABORT 3 The Abort button was selected.
• IDCANCEL 2 The Cancel button was selected.
• IDIGNORE 5 The Ignore button was selected.
• IDNO 7 The No button was selected.
• IDOK 1 The OK button was selected.
• IDRETRY The Retry button was selected.
• IDYES 6 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.
Parameters
lpszText
Points to a CString object or null-terminated string containing the message to be displayed in the message box.
nType
The style of the mes

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值