Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   how to display a number in a messagebox? (http://www.velocityreviews.com/forums/t288181-how-to-display-a-number-in-a-messagebox.html)

sdeyoreo@hotmail.com 01-15-2005 09:45 PM

how to display a number in a messagebox?
 
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);


Mike Wahler 01-15-2005 10:05 PM

Re: how to display a number in a messagebox?
 
<sdeyoreo@hotmail.com> wrote in message
news:bk3ju0tof1gvnc3d2imbmb0j6oo4g909sl@4ax.com...
> 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



Pete 01-15-2005 10:31 PM

Re: how to display a number in a messagebox?
 
<sdeyoreo@hotmail.com> wrote in message
news:bk3ju0tof1gvnc3d2imbmb0j6oo4g909sl@4ax.com...
> 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



sdeyoreo@hotmail.com 01-16-2005 12:37 AM

Re: how to display a number in a messagebox?
 
On Sat, 15 Jan 2005 22:31:58 GMT, "Pete" <x@x.x> wrote:

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


Works great, thanks alot!


All times are GMT. The time now is 12:11 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.