Thread: edit control text buffer

  1. #1
    Registered User
    Join Date
    Dec 2008
    Location
    petaluma, ca
    Posts
    2

    edit control text buffer

    hi,

    I have an multi-line edit control in a modeless dlg. I need to change the text that is displayed with SendDlgItemMessage because it looks like this:

    /************************************************** ******************
    |
    |A.) some text that is a choice for a test answer
    |and it is aligned all the way to the left after a line break
    |
    ************************************************** ******************/

    and I want it to look like this:

    /************************************************** *****************
    |
    |B.) after some text and the edit control line break I want
    | it to look like this, not all the way to the left.
    |
    ************************************************** *****************/
    NOTE: The "|" symbol used above is to show the edit ctrl's left edge, when I previewed the post it aligned the post just like my edit ctrl does! Even so cboard's edit ctrl only allowed one space. I want the 'i' in it to line up under the 'a' in after.

    I've been trying to figure out how to get a handle to the edit control's text buffer heap addr. no luck so far. The msdn site gives thorough info but it is dated 1992 and doesn't seem to work for me. I'm using XP and would like to have the edit ctrl as read-only but will use read/write to make buffer change and switch to ro after if possible. Can I reprogram the line-break code??? subclass?

    Thanks for any help/suggestions

  2. #2
    Registered User
    Join Date
    Mar 2007
    Posts
    416
    first off, use the word [code], and end the code section with [/code] (but not italicized). It'll indent things correctly.

    Second, I think the function is GetDlgItem(). It returns a handle to a dialog item, and as long as you have an UINT identifier (that is global) you can get a handle to the text window through any part of the program.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Location
    petaluma, ca
    Posts
    2

    thanks

    Thanks scwizzo, I've now read kermi3's sticky, won't happen again.

    Doesn't GetDlgItem just return a handle to the edit control? I want to look at the text buffer that Windows allocates for the ec so that I can view the data before it is sent to the
    ec by a call to SendMessage, SendDlgItemMessage...

    Supposedly, since 32 bit Windows, this buffer is allocated in apps local heap as far as I can tell. I've been trying EM_GETHANDLE and get back non-zero, non-neg values in the eax register but they dont seem to point to any valid memory area. I'm going to change my ec to rw and see it that makes a diff.

    I really apprec. your help!

    ~jim

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You could try.......

    getting the text with GetDlgItemText()

    or

    process the parents EN_CHANGE msgs

    then

    set the TAB with EM_SETTABSTOPS
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User
    Join Date
    Mar 2007
    Posts
    416
    Quote Originally Posted by scurvydog View Post
    Doesn't GetDlgItem just return a handle to the edit control?
    Yep, but if you want to use GetDlgItemText like novacain said you'll need a handle to the dialog that contains the edit text box.(unless you have a global handle to it or something).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is Text Modified in Edit Control
    By anon in forum Windows Programming
    Replies: 1
    Last Post: 05-21-2006, 01:33 PM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. adding a line of text to a readonly edit control?
    By Kibble in forum Windows Programming
    Replies: 2
    Last Post: 11-25-2002, 09:04 PM
  4. Replies: 1
    Last Post: 07-13-2002, 05:45 PM
  5. Edit control
    By The15th in forum Windows Programming
    Replies: 2
    Last Post: 09-25-2001, 12:36 PM