EM_EXSETSEL won't work in multiline edit control (c, not c++)

This is a discussion on EM_EXSETSEL won't work in multiline edit control (c, not c++) within the Windows Programming forums, part of the Platform Specific Boards category; hi, I work with a modeless dialog that contains a multiline edit control created with: ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN ...

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    3

    EM_EXSETSEL won't work in multiline edit control (c, not c++)

    hi,

    I work with a modeless dialog that contains a multiline edit control created with:

    ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL

    processing EN_KILLFOCUS I can set text by: SetDlgItemText(), append text with: EM_REPLACESEL and retreave the content of the control using: GetDlgItemText(). everything works fine.

    but I'm unable to determine the length of the text in the control to allocate memory. neither:

    cr.cpMin=0;
    cr.cpMax=-1;
    SendMessage((HWND)lP, EM_EXSETSEL, 0, (LPARAM)&cr);

    nor:

    gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
    gtl.codepage = CP_ACP;
    len = SendMessage((HWND)lP, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, (LPARAM)0);

    both methodes failed to get the size.

    any hint or comment would be great,
    thank you

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    The first line on the Win32 Reference Manual about 'EM_EXSETSEL' says:

    Code:
    The EM_EXSETSEL message selects a range of characters and/or OLE objects in a rich edit control.
    See also the CHARRANGE definition:

    Code:
    The CHARRANGE structure specifies a range of characters 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.

    Hope that helps
    Niara

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 11:56 AM
  2. Multiline Read only Edit
    By gh0st in forum Windows Programming
    Replies: 2
    Last Post: 10-11-2006, 02:13 PM
  3. Extracting Text from Multiline Edit Box
    By The Brain in forum Windows Programming
    Replies: 1
    Last Post: 11-07-2005, 10:14 PM
  4. Multiline Edit Box Parser
    By The Brain in forum Windows Programming
    Replies: 6
    Last Post: 11-01-2005, 06:15 PM
  5. Edit Control
    By sean345 in forum Windows Programming
    Replies: 0
    Last Post: 07-08-2002, 04:22 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21