Jump to content
  • Advertisement
Sign in to follow this  
CRAZY COCONUT COW

SetDlgText noob question

This topic is 4443 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I open a dialog box in CE. a)static short text[] = "13232343" SetDlgText(blah, blah, text); And found a couple of boxes on my Juniper output. Bad. b)like this static char text[3]; text[0]=1;text[1]=32; t[2]=0; SetDlgText(blah, blah, text); a couple of boxes. c)ok like this SetDlgText(blah, blah, TEXT("12423"); works. **** My question is: If I want to display a variable, say x, that changes every second, how do i do that using SetDlgText? int x = time(); definitely not like this SetDlgTexdt(blah, blah, TEXT("x"); I know, I know, pretty stupid, but I have spent a long time trying to tweak, any help will be appreciated. THanks!

Share this post


Link to post
Share on other sites
Advertisement
Honestly, I'm surprised that code even compiled using CE.

Forget trying to use chars. From my recollection, Win CE uses unicode, which is 2 bytes per character. TCHAR is probably a better approach.

Second thing, think of what the parameters to SetDlgText are.

a)static short text[] = "13232343"

First off, this is going to need to be unicode. Second, you want it to be a string, not a pointer to a short.

b)static char text[3];
text[0]=1;text[1]=32; text[2]=0;

I'm surprised this even prints boxes. Whats the ascii for 1? What about 32? Etc.

With regular character codes, you'll receive something like , with unicode, Ġ, not a number.

You want to cast your integer or whatever into a string. But remember, this is WinCE, so cast it into a TCHAR, not just a regular CHAR (it will allow for more cross platform ability, because on systems that are not unicode, TCHAR will act like a char, on systems that are unicode, it will act like a wchar_t).

*EDIT*

With TCHAR, you can use _stprintf to convert the integer to your string.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!