It won't.
It will put a little picture in the MB though.
Just a set of flags for the style. MB_OK is the default so not realy needed.
It won't.
It will put a little picture in the MB though.
Just a set of flags for the style. MB_OK is the default so not realy needed.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
Since you are using MFC, use CString for your buffer to erase the doubt and start first with the simple MessageBox function and then edit afterwards, like the code below.
//char buff[1024];
CString buff;
int answer;
answer = Cube(m_value);
//sprintf(buff, "The value of %i is: %i", m_value, answer);
buff.Format("The value of %d is: %d",m_value,answer);
MessageBox(buff);
Just try that...
Alextrons
If they can, why can't I...
Already got it working:
Thanks a lot for everyone's help.Code:void CWinCubeDlg::OnCube() { // TODO: Add your control notification handler code here char buff[1024]; int answer; UpdateData(TRUE); answer = Cube(m_value); sprintf(buff, "After being cubed, the value of %i is: %i", m_value, answer); MessageBox(buff, "The results...", MB_ICONINFORMATION); }
Not yet, have to think of one...
I have tried everything in this topic, and the compiler constantly gives me the error:
when I try:error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [28]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
from the example at the msdn or something similar.Code:MessageBox("Help, Something went wrong.", "Error", MB_ICONERROR | MB_OK);
Last edited by myle; 05-15-2007 at 08:16 AM.
Shouldn't it be
L"Help, Something went wrong."
or
TEXT ("Help, Something went wrong.")
if you want to use UNICODE?
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
> 11-15-2001, 12:22 AM
You should also read the forum rules about digging up old threads.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.