AfxMessageBox与MessageBox的区别

int  AfxMessageBox(
LPCTSTR lpszText,
UINT nType = MB_OK,
UINT nIDHelp = 0 );

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 message box. Apply any of the message-box styles to the box.  
nIDHelp
The Help-context ID for the message; 0 indicates the application’s default Help context will be used.

 

int  MessageBox(
HWND
hWnd,
LPCTSTR
lpText,
LPCTSTR
lpCaption,
UINT
uType);

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] Long pointer to a null-terminated string that contains the message to be displayed.
lpCaption
[in] Long pointer to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title “Error” is used.
uType
[in] Specifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.

 

1.MessageBox是CWnd的类成员函数。  
  AfxMessageBox是全局API函数。

2.如果使用的是MFC应用程序,两者都可以使用,但用AfxMessageBox更方便。
  如果创建的是SDK,则只能用MessageBox。
  AfxMessageBox是AFX小组为了取代API采取的一种方法。   

3.MessageBox比AfxMessageBox灵活,体现在参数上。因为AfxMessageBox是一个全局函数所以不需要对应一个窗类,同时也不能控制消息框的标题。而MessageBox可以通过参数写明标题内容。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值