how to display a number in a messagebox?

Discussion in 'C++' started by sdeyoreo@hotmail.com, Jan 15, 2005.

  1. Guest

    How do I display the integer in pt.x in a message box?
    I get a error on parameter 2 of MessageBox call:

    char str[255];
    sprintf(str,"point x is %d",pt.x);
    MessageBox(NULL,str,NULL,MB_OK);
    , Jan 15, 2005
    #1
    1. Advertising

  2. Mike Wahler Guest

    <> wrote in message
    news:...
    > How do I display the integer in pt.x in a message box?
    > I get a error on parameter 2 of MessageBox call:
    >
    > char str[255];
    > sprintf(str,"point x is %d",pt.x);
    > MessageBox(NULL,str,NULL,MB_OK);


    What is the error message?

    -Mike
    Mike Wahler, Jan 15, 2005
    #2
    1. Advertising

  3. Pete Guest

    <> wrote in message
    news:...
    > How do I display the integer in pt.x in a message box?
    > I get a error on parameter 2 of MessageBox call:
    >
    > char str[255];
    > sprintf(str,"point x is %d",pt.x);
    > MessageBox(NULL,str,NULL,MB_OK);
    >


    Probably:

    TCHAR str[255];
    _stprintf(str, _T("point x is %d"), pt.x);
    MessageBox(0, str, 0, MB_OK);

    If you're compiling with Unicode support MessageBox is a macro to the
    Unicode MessageBoxW.

    Make sure to include the correct headers (you can find them on MSDN), and
    please direct further Windows questions to
    comp.os.ms-windows.programmer.win32.

    - Pete
    Pete, Jan 15, 2005
    #3
  4. Guest

    On Sat, 15 Jan 2005 22:31:58 GMT, "Pete" <> wrote:

    >TCHAR str[255];
    >_stprintf(str, _T("point x is %d"), pt.x);
    >MessageBox(0, str, 0, MB_OK);


    Works great, thanks alot!
    , Jan 16, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Wilson

    how to display a MessageBox in ASP.net

    Paul Wilson, Jun 21, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,142
    =?Utf-8?B?QW5vdGhlciBvcHRpb24=?=
    Jun 21, 2004
  2. soundar rajan
    Replies:
    2
    Views:
    3,562
    =?Utf-8?B?RG90TmV0SmVyb21l?=
    Feb 24, 2005
  3. Steve Kershaw

    How can I display a MessageBox in ASP.NET?

    Steve Kershaw, May 26, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    3,921
    Steve C. Orr [MVP, MCSD]
    May 26, 2006
  4. Replies:
    0
    Views:
    442
  5. Alexander Vasilevsky

    How display MessageBox in aspx-page?

    Alexander Vasilevsky, Aug 3, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    1,252
    Teemu Keiski
    Aug 3, 2008
Loading...

Share This Page