I'm looking to make a basic edit box word wrap the text in it. I've resized the edit box control to a decent size and I'd like to have the text that is typed into it word wrap. I'm using Visual Studio 2010 and I've set the multiline property to true. Searching online for this yields search results about how to set word wrap properties within the Visual Studio program, not in my actual edit control. I may be getting close with results like EditWordBreakProc and EM_SETWORDBREAKPROC but I'm not finding how to use them.
I ended up creating my own class that handles text functions like word wrapping and font changes.
If you were to go that way then you would probably want to know about GetTextExtentPoint32() which basically looks at an hdc and tells you how long and how high your string is in pixels.
It's the kind of thing I expected to be present on codeproject.com or codeguru.com, but I didn't get any useful hits from either of these places (both usually good places for this kind of thing, even if the people there are over fond of MFC...)
The default wordwrap function breaks a line in a multiline edit control (MLE) at a space character.
What I am trying to figure out is if that is the default behavior, is there a setting I'm missing somewhere? Because the code on that page is custom code to get the edit control to wordwrap at the ~ character. Still, I tried to implement it (and replaced the ~ with a space in the code) with no luck. I'm thinking that I put everything where it was supposed to go from that page except for the WordBreakProc function. I put the prototype at the top, I put the SetDlgItemMessage under WM_INITDIALOG and I put the WordBreakProc function at the bottom of the page. I'm a little fuzzy there on where exactly it is supposed to go.
At any rate, when I try to use that code, I get the message that lpWrdBrkProc was undefined. I'm not sure what lpWrdBrkProc is or where it is supposed to come from but the code on that page doesn't have it declared anywhere.
I've also tried using this line from the yezhucn link: