how to display a number in a messagebox?

S

sdeyoreo

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);
 
M

Mike Wahler

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
 
P

Pete

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top