getting my variable on my MsgBox
A little newbie question...
how do i convert a number (int or DWORD), so i can see it on a MessageBox without getting a conversion-type error??
thanks in advance
quote:Original post by firecast
A little newbie question...
how do i convert a number (int or DWORD), so i can see it on a MessageBox without getting a conversion-type error??
thanks in advance
Declare a buffer, and use wsprintf.
char buffer[1024];wsprintf(buffer, "%d", MyValue);MessageBox(window, buffer, "...", MB_OK
or you could try string stream
string stream will convert all compatible types you stream to it into a single string.
#include "strstream"using namespace std;strstream sstr;int i, n;sstr << i << "string" << n << ends;MessageBox... sstr.str()
string stream will convert all compatible types you stream to it into a single string.
strstream is deprecated, use stringstream instead. The syntax is exactly the same as with strstream, except you should include sstream instead of strstream.
- neophyte
- neophyte
You can also use a switch statement.
switch(MessageBox(NULL, "text", "title", MB_YESNO)){ case ID_YES: //do yes command stuff here break; case ID_NO: //do no command stuff here break;}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement