Greetings People
have question here.Is there any way that I can out put a value (which is stored in a variable )
using MessageBox() .
thanks.
Printable View
Greetings People
have question here.Is there any way that I can out put a value (which is stored in a variable )
using MessageBox() .
thanks.
Can you pass variables TO MessageBox, you mean? If that's the question, then yes.
then how do I do it????
I would think you would need to wsprintf() to a temporary string first then pass that to MessageBox().
Of course, that only applies to primitive variable types (int, long, double, etc.). If you've got a fancy-pants C++ class member that you want to work with then you'll probably need to convert it first.
is there any examples on this SMurf???
thanks
It depends on which language you want to do it in. As I normally use C:-
Code:char szTemp[16]; // this must accomodate AT LEAST the maximum string length of what you want to display PLUS an extra character for null termination
int iValue = 123456789; // the value that you want to display
wsprintf(szTemp, "%i", iValue);
MessageBox(NULL, szTemp, NULL, MB_ICONINFORMATION);
If you have to do this conversion more than once, you might want to use Prelude's stringstream example from the FAQ Section.