⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 richedit.h

📁 希望我上传的这些东西可以对搞编程的程序员有点小小的帮助!谢谢!
💻 H
📖 第 1 页 / 共 3 页
字号:

/* All character format measurements are in twips */
typedef struct _charformat
{
	UINT		cbSize;
	DWORD		dwMask;
	DWORD		dwEffects;
	LONG		yHeight;
	LONG		yOffset;
	COLORREF	crTextColor;
	BYTE		bCharSet;
	BYTE		bPitchAndFamily;
	char		szFaceName[LF_FACESIZE];
} CHARFORMATA;

typedef struct _charformatw
{
	UINT		cbSize;
	DWORD		dwMask;
	DWORD		dwEffects;
	LONG		yHeight;
	LONG		yOffset;
	COLORREF	crTextColor;
	BYTE		bCharSet;
	BYTE		bPitchAndFamily;
	WCHAR		szFaceName[LF_FACESIZE];
} CHARFORMATW;

#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define CHARFORMAT CHARFORMATW
#else
#define CHARFORMAT CHARFORMATA
#endif /* UNICODE */
#else
#define CHARFORMAT CHARFORMATA
#endif /* _RICHEDIT_VER >= 0x0200 */

/* CHARFORMAT masks */
#define CFM_BOLD		0x00000001
#define CFM_ITALIC		0x00000002
#define CFM_UNDERLINE	0x00000004
#define CFM_STRIKEOUT	0x00000008
#define CFM_PROTECTED	0x00000010
#define CFM_LINK		0x00000020		/* Exchange hyperlink extension */
#define CFM_SIZE		0x80000000
#define CFM_COLOR		0x40000000
#define CFM_FACE		0x20000000
#define CFM_OFFSET		0x10000000
#define CFM_CHARSET		0x08000000

/* CHARFORMAT effects */
#define CFE_BOLD		0x0001
#define CFE_ITALIC		0x0002
#define CFE_UNDERLINE	0x0004
#define CFE_STRIKEOUT	0x0008
#define CFE_PROTECTED	0x0010
#define CFE_LINK		0x0020
#define CFE_AUTOCOLOR	0x40000000		/* NOTE: this corresponds to */
										/* CFM_COLOR, which controls it */
#define yHeightCharPtsMost 1638

/* EM_SETCHARFORMAT wParam masks */
#define SCF_SELECTION		0x0001
#define SCF_WORD			0x0002
#define SCF_DEFAULT			0x0000		// Set default charformat or paraformat
#define SCF_ALL				0x0004		// Not valid with SCF_SELECTION or SCF_WORD
#define SCF_USEUIRULES		0x0008		// Modifier for SCF_SELECTION; says that
										//  format came from a toolbar, etc., and
										//  hence UI formatting rules should be
										//  used instead of literal formatting
#define SCF_ASSOCIATEFONT	0x0010		// Associate fontname with bCharSet (one
										//  possible for each of Western, ME, FE,
										//  Thai)
#define SCF_NOKBUPDATE		0x0020		// Do not update the KB layput for this change
										// even if autokeyboard is on.
typedef struct _charrange
{
	LONG	cpMin;
	LONG	cpMax;
} CHARRANGE;

typedef struct _textrange
{
	CHARRANGE chrg;
	LPSTR lpstrText;	/* allocated by caller, zero terminated by RichEdit */
} TEXTRANGEA;

typedef struct _textrangew
{
	CHARRANGE chrg;
	LPWSTR lpstrText;	/* allocated by caller, zero terminated by RichEdit */
} TEXTRANGEW;

#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define TEXTRANGE 	TEXTRANGEW
#else
#define TEXTRANGE	TEXTRANGEA
#endif /* UNICODE */
#else
#define TEXTRANGE	TEXTRANGEA
#endif /* _RICHEDIT_VER >= 0x0200 */


typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);

typedef struct _editstream
{
	DWORD_PTR dwCookie;		/* user value passed to callback as first parameter */
	DWORD	  dwError;		/* last error */
	EDITSTREAMCALLBACK pfnCallback;
} EDITSTREAM;

/* Stream formats. Flags are all in low word, since high word gives
   possible codepage choice. */

#define SF_TEXT			0x0001
#define SF_RTF			0x0002
#define SF_RTFNOOBJS	0x0003		/* Write only */
#define SF_TEXTIZED		0x0004		/* Write only */

#define SF_UNICODE		0x0010		/* Unicode file (UCS2 little endian) */
#define SF_USECODEPAGE	0x0020		/* CodePage given by high word */
#define SF_NCRFORNONASCII 0x40		/* Output /uN for nonASCII */

/* Flag telling stream operations to operate on selection only */
/* EM_STREAMIN  will replace current selection */
/* EM_STREAMOUT will stream out current selection */
#define SFF_SELECTION	0x8000

/* Flag telling stream operations to ignore some FE control words */
/* having to do with FE word breaking and horiz vs vertical text. */
/* Not used in RichEdit 2.0 and later	*/
#define SFF_PLAINRTF	0x4000

/* Flag telling file stream output (SFF_SELECTION flag not set) to persist */
/* \viewscaleN control word. */
#define SFF_PERSISTVIEWSCALE 0x2000

/* Flag telling file stream input with SFF_SELECTION flag not set not to */
/* close the document */
#define SFF_KEEPDOCINFO	0x1000

/* Flag telling stream operations to output in Pocket Word format */
#define SFF_PWD			0x0800

/* 3-bit field specifying the value of N - 1 to use for \rtfN or \pwdN */
#define SF_RTFVAL		0x0700

typedef struct _findtext
{
	CHARRANGE chrg;
	LPCSTR lpstrText;
} FINDTEXTA;

typedef struct _findtextw
{
	CHARRANGE chrg;
	LPCWSTR lpstrText;
} FINDTEXTW;

#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define FINDTEXT	FINDTEXTW
#else
#define FINDTEXT	FINDTEXTA
#endif /* UNICODE */
#else
#define FINDTEXT	FINDTEXTA
#endif /* _RICHEDIT_VER >= 0x0200 */

typedef struct _findtextexa
{
	CHARRANGE chrg;
	LPCSTR	  lpstrText;
	CHARRANGE chrgText;
} FINDTEXTEXA;

typedef struct _findtextexw
{
	CHARRANGE chrg;
	LPCWSTR	  lpstrText;
	CHARRANGE chrgText;
} FINDTEXTEXW;

#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define FINDTEXTEX	FINDTEXTEXW
#else
#define FINDTEXTEX	FINDTEXTEXA
#endif /* UNICODE */
#else
#define FINDTEXTEX	FINDTEXTEXA
#endif /* _RICHEDIT_VER >= 0x0200 */


typedef struct _formatrange
{
	HDC hdc;
	HDC hdcTarget;
	RECT rc;
	RECT rcPage;
	CHARRANGE chrg;
} FORMATRANGE;

/* All paragraph measurements are in twips */

#define MAX_TAB_STOPS 32
#define lDefaultTab 720

/* This is a hack to make PARAFORMAT compatible with RE 1.0 */
#define	wReserved	wEffects

typedef struct _paraformat
{
	UINT	cbSize;
	DWORD	dwMask;
	WORD	wNumbering;
	WORD	wEffects;
	LONG	dxStartIndent;
	LONG	dxRightIndent;
	LONG	dxOffset;
	WORD	wAlignment;
	SHORT	cTabCount;
	LONG	rgxTabs[MAX_TAB_STOPS];
} PARAFORMAT;

/* PARAFORMAT mask values */
#define PFM_STARTINDENT			0x00000001
#define PFM_RIGHTINDENT			0x00000002
#define PFM_OFFSET				0x00000004
#define PFM_ALIGNMENT			0x00000008
#define PFM_TABSTOPS			0x00000010
#define PFM_NUMBERING			0x00000020
#define PFM_OFFSETINDENT		0x80000000

/* PARAFORMAT numbering options */
#define PFN_BULLET		0x0001

/* PARAFORMAT alignment options */
#define PFA_LEFT	0x0001
#define PFA_RIGHT	0x0002
#define PFA_CENTER	0x0003

/* CHARFORMAT2 and PARAFORMAT2 structures */

#ifdef __cplusplus

struct CHARFORMAT2W : _charformatw
{
	WORD		wWeight;			/* Font weight (LOGFONT value)		*/
	SHORT		sSpacing;			/* Amount to space between letters	*/
	COLORREF	crBackColor;		/* Background color					*/
	LCID		lcid;				/* Locale ID						*/
	DWORD		dwReserved;			/* Reserved. Must be 0				*/
	SHORT		sStyle;				/* Style handle						*/
	WORD		wKerning;			/* Twip size above which to kern char pair*/
	BYTE		bUnderlineType;		/* Underline type					*/
	BYTE		bAnimation;			/* Animated text like marching ants */
	BYTE		bRevAuthor;			/* Revision author index			*/
};

struct CHARFORMAT2A : _charformat
{
	WORD		wWeight;			/* Font weight (LOGFONT value)		*/
	SHORT		sSpacing;			/* Amount to space between letters	*/
	COLORREF	crBackColor;		/* Background color					*/
	LCID		lcid;				/* Locale ID						*/
	DWORD		dwReserved;			/* Reserved. Must be 0				*/
	SHORT		sStyle;				/* Style handle						*/
	WORD		wKerning;			/* Twip size above which to kern char pair*/
	BYTE		bUnderlineType;		/* Underline type					*/
	BYTE		bAnimation;			/* Animated text like marching ants	*/
	BYTE		bRevAuthor;			/* Revision author index			*/
};

#else	/* regular C-style  */

typedef struct _charformat2w
{
	UINT		cbSize;
	DWORD		dwMask;
	DWORD		dwEffects;
	LONG		yHeight;
	LONG		yOffset;			/* > 0 for superscript, < 0 for subscript */
	COLORREF	crTextColor;
	BYTE		bCharSet;
	BYTE		bPitchAndFamily;
	WCHAR		szFaceName[LF_FACESIZE];
	WORD		wWeight;			/* Font weight (LOGFONT value)		*/
	SHORT		sSpacing;			/* Amount to space between letters	*/
	COLORREF	crBackColor;		/* Background color					*/
	LCID		lcid;				/* Locale ID						*/
	DWORD		dwReserved;			/* Reserved. Must be 0				*/
	SHORT		sStyle;				/* Style handle						*/
	WORD		wKerning;			/* Twip size above which to kern char pair*/
	BYTE		bUnderlineType;		/* Underline type					*/
	BYTE		bAnimation;			/* Animated text like marching ants	*/
	BYTE		bRevAuthor;			/* Revision author index			*/
	BYTE		bReserved1;
} CHARFORMAT2W;

typedef struct _charformat2a
{
	UINT		cbSize;
	DWORD		dwMask;
	DWORD		dwEffects;
	LONG		yHeight;
	LONG		yOffset;			/* > 0 for superscript, < 0 for subscript */
	COLORREF	crTextColor;
	BYTE		bCharSet;
	BYTE		bPitchAndFamily;
	char		szFaceName[LF_FACESIZE];
	WORD		wWeight;			/* Font weight (LOGFONT value)		*/
	SHORT		sSpacing;			/* Amount to space between letters	*/
	COLORREF	crBackColor;		/* Background color					*/
	LCID		lcid;				/* Locale ID						*/
	DWORD		dwReserved;			/* Reserved. Must be 0				*/
	SHORT		sStyle;				/* Style handle						*/
	WORD		wKerning;			/* Twip size above which to kern char pair*/
	BYTE		bUnderlineType;		/* Underline type					*/
	BYTE		bAnimation;			/* Animated text like marching ants	*/
	BYTE		bRevAuthor;			/* Revision author index			*/
} CHARFORMAT2A;

#endif /* C++ */

#ifdef UNICODE
#define CHARFORMAT2	CHARFORMAT2W
#else
#define CHARFORMAT2 CHARFORMAT2A
#endif

#define CHARFORMATDELTA		(sizeof(CHARFORMAT2) - sizeof(CHARFORMAT))


/* CHARFORMAT and PARAFORMAT "ALL" masks
   CFM_COLOR mirrors CFE_AUTOCOLOR, a little hack to easily deal with autocolor*/

#define CFM_EFFECTS (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | \
					 CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK)
#define CFM_ALL (CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET)

#define	PFM_ALL (PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET	| \
				 PFM_ALIGNMENT   | PFM_TABSTOPS    | PFM_NUMBERING | \
				 PFM_OFFSETINDENT| PFM_RTLPARA)

/* New masks and effects -- a parenthesized asterisk indicates that
   the data is stored by RichEdit 2.0/3.0, but not displayed */

#define CFM_SMALLCAPS		0x0040			/* (*)	*/
#define	CFM_ALLCAPS			0x0080			/* Displayed by 3.0	*/
#define	CFM_HIDDEN			0x0100			/* Hidden by 3.0 */
#define	CFM_OUTLINE			0x0200			/* (*)	*/
#define	CFM_SHADOW			0x0400			/* (*)	*/
#define	CFM_EMBOSS			0x0800			/* (*)	*/
#define	CFM_IMPRINT			0x1000			/* (*)	*/
#define CFM_DISABLED		0x2000
#define	CFM_REVISED			0x4000

#define CFM_BACKCOLOR		0x04000000
#define CFM_LCID			0x02000000
#define	CFM_UNDERLINETYPE	0x00800000		/* Many displayed by 3.0 */
#define	CFM_WEIGHT			0x00400000
#define CFM_SPACING			0x00200000		/* Displayed by 3.0	*/
#define CFM_KERNING			0x00100000		/* (*)	*/
#define CFM_STYLE			0x00080000		/* (*)	*/
#define CFM_ANIMATION		0x00040000		/* (*)	*/
#define CFM_REVAUTHOR		0x00008000

#define CFE_SUBSCRIPT		0x00010000		/* Superscript and subscript are */
#define CFE_SUPERSCRIPT		0x00020000		/*  mutually exclusive			 */

#define CFM_SUBSCRIPT		CFE_SUBSCRIPT | CFE_SUPERSCRIPT
#define CFM_SUPERSCRIPT		CFM_SUBSCRIPT

#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_ALL2	 (CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID \
					| CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR \
					| CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION)

#define	CFE_SMALLCAPS		CFM_SMALLCAPS
#define	CFE_ALLCAPS			CFM_ALLCAPS
#define	CFE_HIDDEN			CFM_HIDDEN
#define	CFE_OUTLINE			CFM_OUTLINE
#define	CFE_SHADOW			CFM_SHADOW
#define	CFE_EMBOSS			CFM_EMBOSS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -