Jump to content
  • Advertisement
Sign in to follow this  
Dookie

Question about 'GetDlgItemText()'

This topic is 4353 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

Hello, it's me. Again. Dang I have a lot of questions today! [grin] This one is really hard to describe, so I hope you can understand what I'm trying to do. I'm trying to use 'GetDlgItemText' to get the text out of an edit control in my dialog box. But when I call it, it doesn't NULL terminate the string at the end of the text; rather, it NULL terminates it at my hard-set limit for GetDlgItemText. For example, char TextData[32]; ZeroMemory( TextData, sizeof(TextData) ); (type "Hi there!" in the edit control labeled 'IDC_TXT_DATA') GetDlgItemText(hDlg, IDC_TXT_DATA, TextData, 16); TextData would be NULL at the 16th array element because I told GetDlgItemText to only read in 16 characters. It is not NULL at element 9, which is the end of the sentence "Hi there!". How do I read text out of an edit control, and make it so the length of the text itself determines where the NULL starts in the character array? Thanks in advance for the help!

Share this post


Link to post
Share on other sites
Advertisement
Nevermind, I was space-terminating the string in one part of my program rather than looking for the start of the NULL. Doh! Anyhoo, I added a space (char 32) to the end of the string and now works in my program.

If you're a moderator and you're reading this, you can delete this thread when you get done laughing. [wink]

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!