Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Go to the end of rich edit control

Go to the end of rich edit control

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Erik Hammar
    wrote on last edited by
    #1

    Hi, How can I move the edit cursor to the end of a rich edit control? I need to append text to the end. Thanks in advance, Erik Hammar

    C 1 Reply Last reply
    0
    • E Erik Hammar

      Hi, How can I move the edit cursor to the end of a rich edit control? I need to append text to the end. Thanks in advance, Erik Hammar

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I do it in Win32 like this:

      ::SetFocus (editControl);
      ::SendMessage (editControl, EM_SETSEL, (WPARAM)length, (LPARAM)length);
      ::SendMessage (editControl, EM_REPLACESEL, 0, (LPARAM) ((LPSTR) str.c_str()));

      I'm sure the MFC class for a rich edit will have methods so you don't need to send messages like this. The basic idea is make the cursor select the end position of the text in there, and then replace the selection ( which is really a caret at the end of the line ) with the text you want to append. length obviously equals the length of the text already there. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups