You create a rich edit control by using the CreateWindow or CreateWindowEx function, specifying the RichEdit window class. Because the common control library registers this window class, you must call the InitCommonControls function to ensure that the library is loaded before creating the control. To use rich edit controls in your application, you must link with the COMCTL32.LIB library. If you are writing your application in C, you must include the COMMCTRL.H header file. Applications must also include the RICHEDIT.H header file, in which rich edit controls are defined. Note that four of the window styles you can use with multiline edit controls cannot be used with rich edit controls: ES_LOWERCASE, ES_PASSWORD, ES_OEMCONVERT, and ES_UPPERCASE.
To explore the rich edit control, I wrote a sample called RICHED. (Do I lose points for uncreative sample names?) The design goals for RICHED were a bit more challenging than those of my previous samples:
The initialization code in the RICHED sample needed to perform the following tasks:
Figure 5-1 offers a sneak peek at the main screen that appears when you start the RICHED sample.
Figure 5-1.