The first line on the Win32 Reference Manual about 'EM_EXSETSEL' says:
See also the CHARRANGE definition:
The EM_EXSETSEL message selects a range of characters and/or OLE objects in a rich edit control.
I'm not tested it, but maybe you want try to create a rich edit control instead an edit control. On a simple edit control (no matter if multiline, autoscrolls, etc), the message to get the text length is WM_GETTEXTLENGTH.
The CHARRANGE structure specifies a range of characters in a rich edit control.
Hope that helps