Click here to Skip to main content
15,881,635 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Trying to use
C++
MessageBox("text","text");


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
Posted
Updated 20-Dec-12 10:34am
v3
Comments
Sergey Alexandrovich Kryukov 8-Mar-13 17:56pm    
You don't need to learn how to use, you need to learn how to read documentation. Everything is clearly explained for you.
—SA

1 solution

In a C++ program using MFC you may use either the Windows API function MessageBox[^] or the MFC 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 from CWnd) while in your SDI application you are using the Windows API function (you are calling it from global scope, that is not in a CWnd-derived object method).
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Mar-13 17:55pm    
Answered, a 5.
—SA
CPallini 9-Mar-13 6:09am    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900