Sign in to follow this  
Dookie

Question about 'GetDlgItemText()'

Recommended Posts

Dookie    290
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
Dookie    290
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this