#ifndef _RICHEDIT_VER
#define _RICHEDIT_VER	0x0300
#endif

#define CF_RTF 			TEXT("Rich Text Format")
#define CF_RTFNOOBJS 	TEXT("Rich Text Format Without Objects")
#define CF_RETEXTOBJ 	TEXT("RichEdit Text and Objects")

#define RICHEDIT_CLASS10A "RICHEDIT"
#define RICHEDIT_CLASSA "RichEdit20A"
#define RICHEDIT_CLASSW L"RichEdit20W"

#if (_RICHEDIT_VER >= 0x0200 )
#ifdef UNICODE
#define RICHEDIT_CLASS		RICHEDIT_CLASSW
#else
#define RICHEDIT_CLASS		RICHEDIT_CLASSA
#endif
#else
#define RICHEDIT_CLASS		RICHEDIT_CLASS10A
#endif

#define BOE_CONTEXTALIGNMENT (16)
#define BOE_CONTEXTREADING (8)
#define BOE_NEUTRALOVERRIDE (4)
#define BOE_PLAINTEXT (2)
#define BOE_RTLDIR (1)

#define BOM_CONTEXTALIGNMENT (16)
#define BOM_CONTEXTREADING (8)
#define BOM_DEFPARADIR (1)
#define BOM_NEUTRALOVERRIDE (4)
#define BOM_PLAINTEXT (2)

#define CFE_ALLCAPS CFM_ALLCAPS
#define CFE_AUTOBACKCOLOR CFM_BACKCOLOR
#define CFE_AUTOCOLOR (1073741824)
#define CFE_BOLD (1)
#define CFE_DISABLED CFM_DISABLED
#define CFE_EMBOSS CFM_EMBOSS
#define CFE_HIDDEN CFM_HIDDEN
#define CFE_IMPRINT CFM_IMPRINT
#define CFE_ITALIC (2)
#define CFE_LINK (32)
#define CFE_OUTLINE CFM_OUTLINE
#define CFE_PROTECTED (16)
#define CFE_REVISED CFM_REVISED
#define CFE_SHADOW CFM_SHADOW
#define CFE_SMALLCAPS CFM_SMALLCAPS
#define CFE_STRIKEOUT (8)
#define CFE_SUBSCRIPT (65536)
#define CFE_SUPERSCRIPT (131072)
#define CFE_UNDERLINE (4)

#define CFM_ALL (CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET)
#define CFM_ALL2	 (CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID \
					| CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR \
					| CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION)
#define CFM_ALLCAPS (128)
#define CFM_ANIMATION (262144)
#define CFM_BACKCOLOR (67108864)
#define CFM_BOLD (1)
#define CFM_CHARSET (134217728)
#define CFM_COLOR (1073741824)
#define CFM_DISABLED (8192)
#define CFM_EFFECTS (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | \
					 CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK)
#define	CFM_EFFECTS2 (CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS \
					| CFM_HIDDEN  | CFM_OUTLINE | CFM_SHADOW | CFM_EMBOSS \
					| CFM_IMPRINT | CFM_DISABLED | CFM_REVISED \
					| CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR)
#define CFM_EMBOSS (2048)
#define CFM_FACE (536870912)
#define CFM_HIDDEN (256)
#define CFM_IMPRINT (4096)
#define CFM_ITALIC (2)
#define CFM_KERNING (1048576)
#define CFM_LCID (33554432)
#define CFM_LINK (32)
#define CFM_OFFSET (268435456)
#define CFM_OUTLINE (512)
#define CFM_PROTECTED (16)
#define CFM_REVAUTHOR (32768)
#define CFM_REVISED (16384)
#define CFM_SHADOW (1024)
#define CFM_SIZE (2147483647)
#define CFM_SMALLCAPS (64)
#define CFM_SPACING (2097152)
#define CFM_STRIKEOUT (8)
#define CFM_STYLE (524288)
#define CFM_SUBSCRIPT (CFE_SUBSCRIPT | CFE_SUPERSCRIPT)
#define CFM_SUPERSCRIPT CFM_SUBSCRIPT
#define CFM_UNDERLINE (4)
#define CFM_UNDERLINETYPE (8388608)
#define CFM_WEIGHT (4194304)

#define CFU_CF1UNDERLINE (255)
#define CFU_INVERT (254)
#define CFU_UNDERLINE (1)
#define CFU_UNDERLINEDASH (5)
#define CFU_UNDERLINEDASHDOT (6)
#define CFU_UNDERLINEDASHDOTDOT (7)
#define CFU_UNDERLINEDOTTED (4)
#define CFU_UNDERLINEDOUBLE (3)
#define CFU_UNDERLINEHAIRLINE (10)
#define CFU_UNDERLINENONE (0)
#define CFU_UNDERLINETHICK (9)
#define CFU_UNDERLINEWAVE (8)
#define CFU_UNDERLINEWORD (2)

#define ECOOP_AND (3)
#define ECOOP_OR (2)
#define ECOOP_SET (1)
#define ECOOP_XOR (4)

#define ECO_AUTOHSCROLL (128)
#define ECO_AUTOVSCROLL (64)
#define ECO_AUTOWORDSELECTION (1)
#define ECO_NOHIDESEL (256)
#define ECO_READONLY (2048)
#define ECO_SAVESEL (32768)
#define ECO_SELECTIONBAR (16777216)
#define ECO_VERTICAL (4194304)
#define ECO_WANTRETURN (4096)

#define EMO_ENTER (1)
#define EMO_EXIT (0)
#define EMO_EXPAND (3)
#define EMO_EXPANDDOCUMENT (1)
#define EMO_EXPANDSELECTION (0)
#define EMO_GETVIEWMODE (5)
#define EMO_MOVESELECTION (4)
#define EMO_PROMOTE (2)

#define EM_AUTOURLDETECT (1115)
#define EM_CANPASTE (1074)
#define EM_CANREDO (1109)
#ifndef EM_POSFROMCHAR
#define EM_POSFROMCHAR (1062)
#define EM_CHARFROMPOS (1063)
#endif
#define EM_CONVPOSITION (1132)
#define EM_DISPLAYBAND (1075)
#define EM_EXGETSEL (1076)
#define EM_EXLIMITTEXT (1077)
#define EM_EXLINEFROMCHAR (1078)
#define EM_EXSETSEL (1079)
#define EM_FINDTEXT (1080)
#define EM_FINDTEXTEX (1103)
#define EM_FINDTEXTEXW (1148)
#define EM_FINDTEXTW (1147)
#define EM_FINDWORDBREAK (1100)
#define EM_FORMATRANGE (1081)
#define EM_GETAUTOURLDETECT (1116)
#define EM_GETBIDIOPTIONS (1225)
#define EM_GETCHARFORMAT (1082)
#define EM_GETEDITSTYLE (1229)
#define EM_GETEVENTMASK (1083)
#define EM_GETIMECOLOR (1129)
#define EM_GETIMECOMPMODE (1146)
#define EM_GETIMEMODEBIAS (1151)
#define EM_GETIMEOPTIONS (1131)
#define EM_GETLANGOPTIONS (1145)
#ifndef EM_GETLIMITTEXT
#define EM_GETLIMITTEXT (1061)
#endif
#define EM_GETOLEINTERFACE (1084)
#define EM_GETOPTIONS (1102)
#define EM_GETPARAFORMAT (1085)
#define EM_GETPUNCTUATION (1125)
#define EM_GETREDONAME (1111)
#define EM_GETSCROLLPOS (1245)
#define EM_GETSELTEXT (1086)
#define EM_GETTEXTEX (1118)
#define EM_GETTEXTLENGTHEX (1119)
#define EM_GETTEXTMODE (1114)
#define EM_GETTEXTRANGE (1099)
#define EM_GETTYPOGRAPHYOPTIONS (1227)
#define EM_GETUNDONAME (1110)
#define EM_GETWORDBREAKPROCEX (1104)
#define EM_GETWORDWRAPMODE (1127)
#define EM_GETZOOM (1248)
#define EM_HIDESELECTION (1087)
#define EM_OUTLINE (1244)
#define EM_PASTESPECIAL (1088)
#define EM_RECONVERSION (1149)
#define EM_REDO (1108)
#define EM_REQUESTRESIZE (1089)
#ifndef EM_SCROLLCARET
#define EM_SCROLLCARET (1073)
#endif
#define EM_SELECTIONTYPE (1090)
#define EM_SETBIDIOPTIONS (1224)
#define EM_SETBKGNDCOLOR (1091)
#define EM_SETCHARFORMAT (1092)
#define EM_SETEDITSTYLE (1228)
#define EM_SETEVENTMASK (1093)
#define EM_SETFONTSIZE (1247)
#define EM_SETIMECOLOR (1128)
#define EM_SETIMEMODEBIAS (1150)
#define EM_SETIMEOPTIONS (1130)
#define EM_SETLANGOPTIONS (1144)
#define EM_SETOLECALLBACK (1094)
#define EM_SETOPTIONS (1101)
#define EM_SETPALETTE (1117)
#define EM_SETPARAFORMAT (1095)
#define EM_SETPUNCTUATION (1124)
#define EM_SETSCROLLPOS (1246)
#define EM_SETTARGETDEVICE (1096)
#define EM_SETTEXTEX (1121)
#define EM_SETTEXTMODE (1113)
#define EM_SETTYPOGRAPHYOPTIONS (1226)
#define EM_SETUNDOLIMIT (1106)
#define EM_SETWORDBREAKPROCEX (1105)
#define EM_SETWORDWRAPMODE (1126)
#define EM_SETZOOM (1249)
#define EM_SHOWSCROLLBAR (1120)
#define EM_STOPGROUPTYPING (1112)
#define EM_STREAMIN (1097)
#define EM_STREAMOUT (1098)

#define ENM_CHANGE (1)
#define ENM_CORRECTTEXT (4194304)
#define ENM_DRAGDROPDONE (16)
#define ENM_DROPFILES (1048576)
#define ENM_IMECHANGE (8388608)
#define ENM_KEYEVENTS (65536)
#define ENM_LANGCHANGE (16777216)
#define ENM_LINK (67108864)
#define ENM_MOUSEEVENTS (131072)
#define ENM_NONE (0)
#define ENM_OBJECTPOSITIONS (33554432)
#define ENM_PARAGRAPHEXPANDED (32)
#define ENM_PROTECTED (2097152)
#define ENM_REQUESTRESIZE (262144)
#define ENM_SCROLL (4)
#define ENM_SCROLLEVENTS (8)
#define ENM_SELCHANGE (524288)
#define ENM_UPDATE (2)

#define EN_ALIGNLTR (1808)
#define EN_ALIGNRTL (1809)
#define EN_CORRECTTEXT (1797)
#define EN_DRAGDROPDONE (1804)
#define EN_DROPFILES (1795)
#define EN_IMECHANGE (1799)
#define EN_LINK (1803)
#define EN_MSGFILTER (1792)
#define EN_OBJECTPOSITIONS (1802)
#define EN_OLEOPFAILED (1801)
#define EN_PARAGRAPHEXPANDED (1805)
#define EN_PROTECTED (1796)
#define EN_REQUESTRESIZE (1793)
#define EN_SAVECLIPBOARD (1800)
#define EN_SELCHANGE (1794)
#define EN_STOPNOUNDO (1798)

#define ES_DISABLENOSCROLL (8192)
#if (_RICHEDIT_VER >= 200)
#define ES_EX_NOCALLOLEINIT (0)
#else
#define ES_EX_NOCALLOLEINIT	(16777216)
#endif
#define ES_NOIME (524288)
#define ES_NOOLEDRAGDROP (8)
#define ES_SAVESEL (32768)
#define ES_SELECTIONBAR (16777216)
#define ES_SELFIME (262144)
#define ES_SUNKEN (16384)
#define ES_VERTICAL (4194304)

#define FR_MATCHALEFHAMZA (2147483647)
#define FR_MATCHDIAC (536870912)
#define FR_MATCHKASHIDA (1073741824)

#define GCM_RIGHTMOUSEDROP (32768)

#define GTL_CLOSE (4)
#define GTL_DEFAULT (0)
#define GTL_NUMBYTES (16)
#define GTL_NUMCHARS (8)
#define GTL_PRECISE (2)
#define GTL_USECRLF (1)

#define GT_DEFAULT (0)
#define GT_SELECTION (2)
#define GT_USECRLF (1)

#define ICM_LEVEL2 (2)
#define ICM_LEVEL2_5 (3)
#define ICM_LEVEL2_SUI (4)
#define ICM_LEVEL3 (1)
#define ICM_NOTOPEN (0)

#define IMF_AUTOFONT (2)
#define IMF_AUTOFONTSIZEADJUST (16)
#define IMF_AUTOKEYBOARD (1)
#define IMF_CLOSESTATUSWINDOW (8)
#define IMF_DUALFONT (128)
#define IMF_FORCEACTIVE (64)
#define IMF_FORCEDISABLE (4)
#define IMF_FORCEENABLE (2)
#define IMF_FORCEINACTIVE (128)
#define IMF_FORCENONE (1)
#define IMF_FORCEREMEMBER (256)
#define IMF_IMEALWAYSSENDNOTIFY (8)
#define IMF_IMECANCELCOMPLETE (4)
#define IMF_MULTIPLEEDIT (1024)
#define IMF_UIFONTS (32)
#define IMF_VERTICAL (32)

#define MAX_TAB_STOPS (32)

#define OLEOP_DOVERB (1)

#define PC_DELIMITER (4)
#define PC_FOLLOWING (1)
#define PC_LEADING (2)
#define PC_OVERFLOW (3)

#define PFA_CENTER (3)
#define PFA_FULL_GLYPHS (7)
#define PFA_FULL_INTERLETTER (5)
#define PFA_FULL_INTERWORD (4)
#define PFA_FULL_SCALED (6)
#define PFA_JUSTIFY (4)
#define PFA_LEFT (1)
#define PFA_RIGHT (2)
#define PFA_SNAP_GRID (8)

#define PFE_BOX (PFM_BOX	>> 16)
#define PFE_COLLAPSED (PFM_COLLAPSED	>> 16)
#define PFE_DONOTHYPHEN (PFM_DONOTHYPHEN >> 16) 
#define PFE_KEEP (PFM_KEEP	>> 16) 
#define PFE_KEEPNEXT (PFM_KEEPNEXT	>> 16) 
#define PFE_NOLINENUMBER (PFM_NOLINENUMBER	>> 16) 
#define PFE_NOWIDOWCONTROL (PFM_NOWIDOWCONTROL	>> 16) 
#define PFE_OUTLINELEVEL (PFM_OUTLINELEVEL	>> 16) 
#define PFE_PAGEBREAKBEFORE (PFM_PAGEBREAKBEFORE >> 16) 
#define PFE_RTLPARA (PFM_RTLPARA	>> 16)
#define PFE_SIDEBYSIDE (PFM_SIDEBYSIDE	>> 16) 
#define PFE_TABLE (16384)

#define PFM_ALIGNMENT (8)
#define	PFM_ALL (PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET	| \
				 PFM_ALIGNMENT   | PFM_TABSTOPS    | PFM_NUMBERING | \
				 PFM_OFFSETINDENT| PFM_RTLPARA)
#define PFM_ALL2	(PFM_ALL | PFM_EFFECTS | PFM_SPACEBEFORE | PFM_SPACEAFTER \
					| PFM_LINESPACING | PFM_STYLE | PFM_SHADING | PFM_BORDER \
					| PFM_NUMBERINGTAB | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE)
#define PFM_BORDER (2048)
#define PFM_BOX (67108864)
#define PFM_COLLAPSED (16777216)
#define PFM_DONOTHYPHEN (4194304)
#define PFM_EFFECTS (PFM_RTLPARA | PFM_KEEP | PFM_KEEPNEXT | PFM_TABLE \
					| PFM_PAGEBREAKBEFORE | PFM_NOLINENUMBER  \
					| PFM_NOWIDOWCONTROL | PFM_DONOTHYPHEN | PFM_SIDEBYSIDE \
					| PFM_TABLE)
#define PFM_KEEP (131072)
#define PFM_KEEPNEXT (262144)
#define PFM_LINESPACING (256)
#define PFM_NOLINENUMBER (1048576)
#define PFM_NOWIDOWCONTROL (2097152)
#define PFM_NUMBERING (32)
#define PFM_NUMBERINGSTART (32768)
#define PFM_NUMBERINGSTYLE (8192)
#define PFM_NUMBERINGTAB (16384)
#define PFM_OFFSET (4)
#define PFM_OFFSETINDENT (2147483647)
#define PFM_OUTLINELEVEL (33554432)
#define PFM_PAGEBREAKBEFORE (524288)
#define PFM_RIGHTINDENT (2)
#define PFM_RTLPARA (65536)
#define PFM_SHADING (4096)
#define PFM_SIDEBYSIDE (8388608)
#define PFM_SPACEAFTER (128)
#define PFM_SPACEBEFORE (64)
#define PFM_STARTINDENT (1)
#define PFM_STYLE (1024)
#define PFM_TABLE (1073741824)
#define PFM_TABSTOPS (16)

#define PFNS_NONUMBER (1024)
#define PFNS_PAREN (0)
#define PFNS_PARENS (256)
#define PFNS_PERIOD (512)
#define PFNS_PLAIN (768)

#define PFN_ARABIC (2)
#define PFN_BULLET (1)
#define PFN_LCLETTER (3)
#define PFN_LCROMAN (5)
#define PFN_UCLETTER (4)
#define PFN_UCROMAN (6)

#define SCF_ALL (4)
#define SCF_ASSOCIATEFONT (16)
#define SCF_DEFAULT (0)
#define SCF_NOKBUPDATE (32)
#define SCF_SELECTION (1)
#define SCF_USEUIRULES (8)
#define SCF_WORD (2)

#define SEL_EMPTY (0)
#define SEL_MULTICHAR (4)
#define SEL_MULTIOBJECT (8)
#define SEL_OBJECT (2)
#define SEL_TEXT (1)

#define SES_ALLOWBEEPS (256)
#define SES_BEEPONMAXTEXT (2)
#define SES_BIDI (4096)
#define SES_EMULATE10 (16)
#define SES_EMULATESYSEDIT (1)
#define SES_EXTENDBACKCOLOR (4)
#define SES_LOWERCASE (1024)
#define SES_MAPCPS (8)
#define SES_NOIME (128)
#define SES_NOINPUTSEQUENCECHK (2048)
#define SES_SCROLLONKILLFOCUS (8192)
#define SES_UPPERCASE (512)
#define SES_USEAIMM (64)
#define SES_USECRLF (32)
#define SES_XLTCRCRLFTOCR (16384)

#define SFF_KEEPDOCINFO (4096)
#define SFF_PERSISTVIEWSCALE (8192)
#define SFF_PLAINRTF (16384)
#define SFF_PWD (2048)
#define SFF_SELECTION (32768)

#define SF_NCRFORNONASCII (64)
#define SF_RTF (2)
#define SF_RTFNOOBJS (3)
#define SF_RTFVAL (1792)
#define SF_TEXT (1)
#define SF_TEXTIZED (4)
#define SF_UNICODE (16)
#define SF_USECODEPAGE (32)

#define ST_DEFAULT (0)
#define ST_KEEPUNDO (1)
#define ST_SELECTION (2)

#define TO_ADVANCEDTYPOGRAPHY (1)
#define TO_SIMPLELINEBREAK (2)

#define VM_NORMAL (4)
#define VM_OUTLINE (2)

#define WBF_BREAKAFTER BYTE 64
#define WBF_BREAKLINE BYTE 32
#define WBF_CLASS BYTE 15
#define WBF_CUSTOM (512)
#define WBF_ISWHITE BYTE 16
#define WBF_LEVEL1 (128)
#define WBF_LEVEL2 (256)
#define WBF_OVERFLOW (64)
#define WBF_WORDBREAK (32)
#define WBF_WORDWRAP (16)

#define WB_CLASSIFY (3)
#define WB_LEFTBREAK (6)
#define WB_MOVEWORDLEFT (4)
#define WB_MOVEWORDNEXT (5)
#define WB_MOVEWORDPREV (4)
#define WB_MOVEWORDRIGHT (5)
#define WB_NEXTBREAK (7)
#define WB_PREVBREAK (6)
#define WB_RIGHTBREAK (7)

#ifndef WCH_EMBEDDING
#define WCH_EMBEDDING WCHAR 65532
#endif

#ifndef WM_CONTEXTMENU
#define WM_CONTEXTMENU (123)
#endif
#ifndef WM_NOTIFY
#define WM_NOTIFY (78)
#ifndef RC_INVOKED
typedef struct _nmhdr
{
	HWND	hwndFrom;
	UINT	idFrom;
	UINT	code;
} NMHDR;
#endif
#endif
#ifndef WM_PRINTCLIENT
#define WM_PRINTCLIENT (792)
#endif

#define cchTextLimitDefault (32767)

#define lDefaultTab (720)

#define wReserved wEffects

#define yHeightCharPtsMost (1638)


