RichEdit & EM_EXGETSEL

This is a discussion on RichEdit & EM_EXGETSEL within the Windows Programming forums, part of the Platform Specific Boards category; I have this text on my richeditor. Code: Hello world I'd like to add a command such "Add bold" to ...

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

    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, 01:17 PM
  3. multiline richedit scrolling issue
    By tyouk in forum Windows Programming
    Replies: 1
    Last Post: 11-03-2003, 04:59 AM
  4. Problems with my richedit...
    By tyouk in forum Windows Programming
    Replies: 2
    Last Post: 11-02-2003, 03:57 AM
  5. RichEdit Problem
    By dirkduck in forum Windows Programming
    Replies: 0
    Last Post: 07-24-2003, 05:50 PM

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