如何改变AfxMessageBox提示窗口的标题栏

subeauty 2006-01-11 08:09:41
如何改变AfxMessageBox提示窗口的标题栏,使用MessageBox函数有什么前提条件呀,我使用MessageBox函数时出现下面错误
error C2660: 'MessageBoxA' : function does not take 3 parameters
是什么原因呀
...全文
356 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lonkil 2006-01-12
  • 打赏
  • 举报
回复
汗!
arvid_gs 2006-01-11
  • 打赏
  • 举报
回复
这个问题回答的人真多阿!!
eleek 2006-01-11
  • 打赏
  • 举报
回复
封装在CWnd类里的MessageBox是三个参数,但是WindowsAPI的messagebox是四个参数
估计编译器认为你是用API的MessageBox,而不是CWnd类里面的MessageBox了,所以你少了个参数,第一个参数为窗口句柄。
建议你用下面这个方式:
::MessageBox(NULL,_T("确实要这样吗?"), "提示", MB_YESNO)

冒号表示用的是Windows API,第一个参数为NULL,表示弹出的消息框的父窗口为桌面,你也可以设为你的应用里的某个窗口。
rdsnow 2006-01-11
  • 打赏
  • 举报
回复
MessageBox("文本内容","标题",MB_OK);

里面本来就是三个参数。
小猿高飞 2006-01-11
  • 打赏
  • 举报
回复
例子:
if (MessageBox(_T("确实要这样吗?"), "提示", MB_YESNO) == IDNO)
{
return;
}
三个参数分别为 要提示的内容,标题,按钮类型;
eleek 2006-01-11
  • 打赏
  • 举报
回复
MessageBox需要四个参数,具体解释如下:
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.
eleek 2006-01-11
  • 打赏
  • 举报
回复
把你的代码写出来看看吧。
用MessageBox没有什么前提条件。
你的那个提示,说明你用错了,参数个数不对,你把你的代码贴出来看看。

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧