Thread: RichEdit & EM_EXGETSEL

  1. #1
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    310

    RichEdit & EM_EXGETSEL

    I have this text on my richeditor.
    Code:
    Hello world
    I'd like to add a command such "Add bold" to insert string, like this:
    Code:
    <b>Hello</b> world
    I know How to get the start and end chars with EM_EXGETSEL, but how to insert strings?
    Thanks
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    125
    You could try using EM_EXSETSEL to set the selection so that it begins and ends at the place you want to insert text, and then use EM_SETTEXTEX to insert the text.
    The procedure should be the same as with a regular edit control, except using EM_EXSETSEL instead of EM_SETSEL and EM_SETTEXTEX instead of EM_REPLACESEL.

    Info on the EM_SETTEXTEX message:
    http://msdn2.microsoft.com/en-gb/library/ms652188.aspx
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. RichEdit need help!!!
    By lucas4ce in forum Windows Programming
    Replies: 1
    Last Post: 08-21-2004, 02:27 PM
  2. Drawing on a RichEdit?
    By Sea Monster in forum Windows Programming
    Replies: 5
    Last Post: 12-30-2003, 02:17 PM
  3. multiline richedit scrolling issue
    By tyouk in forum Windows Programming
    Replies: 1
    Last Post: 11-03-2003, 05:59 AM
  4. Problems with my richedit...
    By tyouk in forum Windows Programming
    Replies: 2
    Last Post: 11-02-2003, 04:57 AM
  5. RichEdit Problem
    By dirkduck in forum Windows Programming
    Replies: 0
    Last Post: 07-24-2003, 05:50 PM