MessageBox questions...

This is a discussion on MessageBox questions... within the Windows Programming forums, part of the Platform Specific Boards category; It won't. It will put a little picture in the MB though. Just a set of flags for the style. ...

  1. #16
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    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

  2. #17
    Registered User
    Join Date
    Oct 2001
    Posts
    23
    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...

  3. #18
    Registered User -leech-'s Avatar
    Join Date
    Nov 2001
    Posts
    54
    Already got it working:
    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);
    }
    Thanks a lot for everyone's help.
    Not yet, have to think of one...

  4. #19
    Registered User
    Join Date
    Apr 2007
    Location
    Greece
    Posts
    52
    I have tried everything in this topic, and the compiler constantly gives me the error:
    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
    when I try:

    Code:
    MessageBox("Help, Something went wrong.", "Error", 
          MB_ICONERROR | MB_OK);
    from the example at the msdn or something similar.
    Last edited by myle; 05-15-2007 at 08:16 AM.

  5. #20
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    Shouldn't it be
    L"Help, Something went wrong."

    or
    TEXT ("Help, Something went wrong.")

    if you want to use UNICODE?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  6. #21
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,340
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Delete files that are used
    By Yuri in forum C++ Programming
    Replies: 8
    Last Post: 10-18-2005, 01:48 PM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 08:44 AM
  5. EnterCriticalSection and MessageBox
    By novacain in forum Windows Programming
    Replies: 13
    Last Post: 01-30-2003, 07:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21