Thread: Reading an EditBox control

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    Reading an EditBox control

    I have the next multi-line Editbox control:
    Code:
    CreateWindowEx(NULL, "Edit", "", WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL
                             | ES_AUTOVSCROLL | ES_MULTILINE | WS_TABSTOP, 101, 165, 366, 148, hwnd,
                             (HMENU)IDC_EDIT_MSGBODY, GetModuleHandle(NULL), NULL);
    What I would like to do is to be able to read the text one line at a time, or something like that, but not the entire thing all at once. Is this possible?


    Thank you.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I think you can do it by using the EM_GETLINE message.

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    I've looked through the control messages, but couldn't find any way I could read a set number of chars into a buffer, can I do that?


    thanks again.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Quote Originally Posted by Devil Panther
    I've looked through the control messages, but couldn't find any way I could read a set number of chars into a buffer, can I do that?
    Quote Originally Posted by Dante Shamest
    I think you can do it by using the EM_GETLINE message.
    Maybe I'm misunderstanding you, but if what you want to do is read a line from the edit control into a buffer (of which the size you specify), EM_GETLINE will do it.

  5. #5
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    i want to read number of lines at sames time to the same buffer, with a single message, if possible
    Last edited by Devil Panther; 08-20-2005 at 02:00 PM.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  6. #6
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Copy the buffer pointer, use a for loop and increment the pointer by the return value (you may also need to add "\r\n" on the end).

    To do it all in a single message, subclass the edit control, make a new message (using a value above WM_USER) and do as above.

  7. #7
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    i see. thank you.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Appending to an edit control
    By TheDan in forum Windows Programming
    Replies: 2
    Last Post: 03-31-2006, 12:27 PM
  2. creating an activex control
    By Benzakhar in forum Windows Programming
    Replies: 9
    Last Post: 12-29-2003, 06:32 PM
  3. Updating a list control
    By MPSoutine in forum Windows Programming
    Replies: 2
    Last Post: 12-05-2003, 02:03 AM
  4. Problems with my edit control...
    By tyouk in forum Windows Programming
    Replies: 19
    Last Post: 10-19-2003, 12:36 AM
  5. \n\r in an editbox control???
    By Devil Panther in forum Windows Programming
    Replies: 1
    Last Post: 07-18-2003, 04:18 AM