Rookie
Rookie

Reputation: 3793

How to get the length of a dialog item text?

Im trying to get the dialog item text into a buffer. It works with GetDlgItemText(), but how do i get the length of the text so i can allocate the buffer before i read it in there? I want to be sure i always get the whole text. I could use always for example 10k buffer, but it would be nicer if there wasnt any chance that the user text isnt received completely.

Upvotes: 1

Views: 814

Answers (1)

David Heffernan
David Heffernan

Reputation: 612794

Send the window handle, obtained by calling GetDlgItem, a WM_GETTEXTLENGTH message. Or if you prefer call GetWindowTextLength.

Upvotes: 3

Related Questions