MessageBox的问题 [英] Problem with MessageBox
本文介绍了MessageBox的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用
MessageBox("text","text");
这个在对话框项目中编译好但不在单个文档项目中 - 状态不需要2个参数。
AfxMessageBox()有效,但我想要在标题框中插入标题似乎不允许我。
不确定要使用什么?
请帮助
this compiles ok in a dialog project but not in a single document project- states does not take 2 params.
AfxMessageBox() works but I want to insert the title in the box and does not seem to let me.
Not sure what to use ?
please help
推荐答案
在C ++
程序中使用MFC
您可以使用Windows API
函数 MessageBox [ ^ ]或MFC
方法 CWnd :: MessageBox [ ^ ]。
前者需要四个参数,后者可能需要三个,两个或只有一个参数(因为它有两个可选参数)。
在对话框应用程序中,您可能正在使用对话框的方法(CDialog
继承自CWnd
)在您的SDI
应用程序中,您正在使用Windows API
函数(您从全局范围调用它) ,这不是CWnd
- 派生的对象方法。)
In aC++
program usingMFC
you may use either theWindows API
function MessageBox[^] or theMFC
method CWnd::MessageBox[^].
The former takes four parameters, the latter may take three, two or just one parameter (because it has two optional parameters).
In your dialog application you are probably using the dialog''s method (CDialog
inherits fromCWnd
) while in yourSDI
application you are using theWindows API
function (you are calling it from global scope, that is not in aCWnd
-derived object method).
这篇关于MessageBox的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文