RichEdit Emoticon Shortcuts

Murray Sargent

Seems many email messages and IM’s include emoji smiley faces like 😊. You just type πŸ™‚ and you get πŸ˜‰ whether you want it or not! About a year ago, the Microsoft 365 RichEdit started offering such a facility. This post describes the built-in emoticon shortcut strings and the corresponding emoji characters and the APIs for enabling the conversions. For a substantially larger set of emoticons, see https://en.wikipedia.org/wiki/List_of_emoticons. That list includes both Western and Eastern emoticons. The RichEdit emoticon shortcuts currently include only Western emoticons.

The build-in emoticon shortcuts are defined in the table

Type Get Unicode
%) πŸ˜• U+1F615
0:) πŸ˜‡ U+1F607
:'( 😒 U+1F622
:') πŸ˜‚ U+1F602
:'-( 😒 U+1F622
:'-) πŸ˜‚ U+1F602
:( ☹ U+02639
:) ☺️ U+0263A
:+1: πŸ‘ U+1F44D
:-( ☹ U+02639
:-) 😊 U+1F60A
:-D πŸ˜ƒ U+1F603
:-o 😲 U+1F632
:-p 😝 U+1F61D
:-| 😐 U+1F610
:D πŸ˜ƒ U+1F603
:fire: πŸ”₯ U+1F525
:grin: 😁 U+1F601
:o 😲 U+1F632
:p 😝 U+1F61D
:smile: πŸ˜„ U+1F604
:yum: πŸ˜‹ U+1F60B
:| 😐 U+1F610
;) πŸ˜‰ U+1F609
;-) πŸ˜‰ U+1F609
</3 πŸ’” U+1F494
<3 ❀ U+02764
>:) 😈 U+1F608
B-) 😎 U+1F60E

 

How to enable emoticon shortcuts

The emoticon shortcut facility is incorporated into the RichEdit autocorrect facility. To enable the autocorrect facility, send the message EM_SETAUTOCORRECTPROC with wparam = an AutoCorrectProc callback pointer. If you don’t want to implement an autocorrect callback, set wparam = 1. This activates the built-in math autocorrect facility in math zones. It also activates emoticon shortcuts if they’re enabled. To enable the emoticon shortcuts, get the current language-option flags by sending EM_GETLANGOPTIONS, OR in IMF_EMOTICONSHORTCUTS (0x8000), and send EM_SETLANGOPTIONS with lparam equal to the result. The emoticon-shortcut option is disabled by default. Have fun 😎