Rich edit

This is a discussion on Rich edit within the Windows Programming forums, part of the Platform Specific Boards category; Well, Petzold and Schildt don't really touch upon the rick edit control, and I do need to use one. Simply ...

  1. #1
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584

    Rich edit

    Well, Petzold and Schildt don't really touch upon the rick edit control, and I do need to use one. Simply just to change the color of certain words. Just that. But I have no idea how to do this or go about using a rich edit. How would I create this rich edit? Just like a normal edit except a different class name? And, how would I change the color of certain words when they're typed in?
    1978 Silver Anniversary Corvette

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    I think you can do this with a EM_SETCHARFORMAT message and pass a pointer to a CHARFORMAT structure as the lParam

    I dont have any tutorials, so I can only suggest Google and the SDK.....

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Hi Garfield, I have an example of how to create a rich edit on [shameless plug] my wee, humble website.[/shameless plug]

    It's a tiny, little bit more involved than creating other standard controls as you have to dynamically load the dll containing the version of the control you need (or is supported) at run time.

    Hope that's of some use to you.

  4. #4
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Why would you have to do dynamic loading of a dll?
    1978 Silver Anniversary Corvette

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by Garfield
    Why would you have to do dynamic loading of a dll?
    You cant know which version of the Rich Edit control each target computer has.......I think there's version 1, 2 or 3!!!

    So what you do is try map riched20.dll into your address space using load library......if the return is NULL, then try riched32.dll.....this gives an older version of the control.......

    Ken's site has a good tutorial of this....have a look

  6. #6
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    I tried a rich edit control and found some info on http://msdn.microsoft.com.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Some extra info paraphrased from msdn:

    There are 3 richedit versions defined in two separate dll's - version 1.0 (riched32.dll) and version 2.0/3.0 (riched20.dll).

    And copied from msdn:
    The following list describes which versions of Rich Edit are included in which releases Microsoft® Windows®.

    Windows XP
    Includes Rich Edit 3.0 with a Rich Edit 1.0 emulator.
    Windows Me
    Includes Rich Edit 1.0 and 3.0.
    Windows 2000
    Includes Rich Edit 3.0 with a Rich Edit 1.0 emulator.
    Windows NT 4.0
    Includes Rich Edit 1.0 and 2.0.
    Windows 98
    Includes Rich Edit 1.0 and 2.0.
    Windows 95
    Includes only Rich Edit 1.0. However, Riched20.dll is compatible with Windows 95 and may be installed by an application that requires it.
    On Windows 95/98/Me, Rich Edit 1.0 is localized so that it works with a particular OS that is similarly localized. For example, on Japanese versions of an OS, Rich Edit 1.0 can display Japanese, but not Arabic.
    (Sorry, I couldn't find the original link). Hope that is of some use.

  8. #8
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Okay, so how do you load this dll? I think I'm goign to go look at Fitlike's site...
    1978 Silver Anniversary Corvette

  9. #9
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    You just do this:
    Code:
    LoadLibrary("Riched20.dll");
    or what ever DLL you want. This registers the window class for you.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  10. #10
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by sean345
    You just do this:
    Code:
    LoadLibrary("Riched20.dll");
    or what ever DLL you want. This registers the window class for you.

    - Sean
    Err...not really....it loads the dll into your address space (making its exported functions & data available), calls the dll's entry point with a DLL_PROCESS_ATTACH message and returns a handle to the module...

  11. #11
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    Originally posted by Fordy


    Err...not really....it loads the dll into your address space (making its exported functions & data available), calls the dll's entry point with a DLL_PROCESS_ATTACH message and returns a handle to the module...
    When it calls the DLL_PROCESS_ATTACH it registers the class. I was just trying to sum up what it did in terms of the richedit control.

    You should also check to see if it was loaded properly by the handle it returns and then unload the library when you exit.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. line number on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-18-2008, 06:58 AM
  2. can't disable ctrl-V on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-06-2008, 07:37 AM
  3. rich edit 4.1 is giving me a head-ache
    By master5001 in forum Windows Programming
    Replies: 3
    Last Post: 07-01-2005, 01:21 PM
  4. How the rich get rich [Long]
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 05-05-2005, 10:36 PM
  5. newbie to rich edit, cant get it to work
    By hanhao in forum Windows Programming
    Replies: 1
    Last Post: 03-24-2004, 09:54 PM

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