Wednesday, August 31, 2005 2:37 PMHi,
I'm new to C++, have started to use VC++ 2003 at work and dont know much about it because i have only used Java and VB before now. I cant use the debugger for reasons that arent relevant here but all i want to do is use a MessageBox to display an int! I cant seem to do this no matter what i try. I dont care if i have to use the AfxMessageBox function instead but please some one tell me how its done! I'll give you the example below
int back_color = 2;
how do i display that 2 or rather back_color in a messagebox? thats all i am asking!
Wednesday, August 31, 2005 4:27 PMHi Will,
You have to pass a string to the MessageBox APIs. Here's an example of how to get a string to display the int value in VS 2005 (if you're using 2003, just remove the "L" in front of the first argument to s.Format):
Hope this helps,
Thursday, September 01, 2005 8:48 AM
Thanks, although i am using 2003 and i had to keep the 'L' in, so i take it FORMAT is a method in the CString class?
Thursday, September 01, 2005 10:32 PMYes, format is a method in the CString class.
The "L" is needed if you are building for Unicode. I just mentioned it since the default for VS2003 was ANSI and the default for VS2005 is Unicode. You can change the defaults on either platform.
I'm glad this helped.