>LOCAL lcCharFormat, loCharFormat >DECLARE INTEGER SendMessage IN Win32API INTEGER, INTEGER, INTEGER, STRING >#DEFINE WM_USER 0x400 >#DEFINE EM_SETCHARFORMAT (WM_USER + 68) >#DEFINE CFE_PROTECTED 0x00000010 >#DEFINE CFM_BACKCOLOR 0x04000000 >#DEFINE CFM_PROTECTED 0x00000016 >#DEFINE SCF_SELECTION 0x00000001 >WITH this.Parent > IF .RTFTextObj.SelLength > 0 > loCharFormat = GetCharFormatStruct() > loCharFormat.crBackColor = .Highlight.Fillcolor > loCharFormat.dwMask = BITOR(CFM_PROTECTED,CFM_BACKCOLOR) > loCharFormat.dwEffects = CFE_PROTECTED > lcCharFormat = loCharFormat.GetString() > IF !EMPTY(lcCharFormat) > IF SendMessage(.RTFTextObj.hWnd, EM_SETCHARFORMAT, BITOR(SCF_SELECTION,SCF_WORD), @lcCharFormat) = 0 > WAIT WINDOW "Set Background Color Failed" NOWAIT > ENDIF > ENDIF > RELEASE loCharFormat > ENDIF >ENDWITH >>
>************************************************************************************************ >* >* Procedure for setting the character font format of the selected text in a RichEdit control >* (uses the STRUCT.VCX class developed by Christof Lange and Mark Wilden) >* >FUNCTION GetCharFormatStruct > LOCAL loCharFormat > loCharFormat = CREATEOBJECT("CharFormat2") > RETURN loCharFormat >ENDFUNC > > >DEFINE CLASS CharFormat2 AS Struct OF "struct.vcx" > cbSize = 0 > dwMask = 0 > dwEffects = 0 > yHeight = 0 > yOffset = 0 > crTextColor = 0 > bCharSet = 0 > bPitchAndFamily = 0 > szFaceName = "" > wWeight = 0 > sSpacing = 0 > crBackColor = 0 > lcid = 0 > dwReserved = 0 > sStyle = 0 > wKerning = 0 > bUnderlineType = 0 > bAnimation = 0 > bRevAuthor = 0 > bReserved1 = 0 > > PROCEDURE init > DODEFAULT() > this.cbsize = this.sizeof() > ENDPROC > > PROCEDURE GetCMembers > RETURN "UINT ul:cbSize," + ; > "DWORD ul:dwMask," + ; > "DWORD ul:dwEffects," + ; > "LONG l:yHeight," + ; > "LONG l:yOffset," + ; > "COLORREF ul:crTextColor," + ; > "BYTE b:bCharSet," + ; > "BYTE b:bPitchAndFamily," + ; > "TCHAR 0c32:szFaceName," + ; > "WORD uw:wWeight," + ; > "SHORT w:sSpacing," + ; > "COLORREF ul:crBackColor," + ; > "LCID ul:lcid," + ; > "DWORD ul:dwReserved," + ; > "SHORT w:sStyle," + ; > "WORD uw:wKerning," + ; > "BYTE b:bUnderlineType," + ; > "BYTE b:bAnimation," + ; > "BYTE b:bRevAuthor," + ; > "BYTE b:bReserved1" > ENDPROC >ENDDEFINE >>
cbSize = 0 dwMask = 0 dwEffects = 0 yHeight = 0 yOffset = 0 crTextColor = 0 bCharSet = 0 bPitchAndFamily = 0 szFaceName = "" ****** *** CHARFORMAT structure word alignment wPad = 0 ****** wWeight = 0 sSpacing = 0 crBackColor = 0 lcid = 0 dwReserved = 0 sStyle = 0 wKerning = 0 bUnderlineType = 0 bAnimation = 0 bRevAuthor = 0 bReserved1 = 0Now, there are other things that involved RichEdit control. So, I have a few question first:
? GetModuleHandle( 'RichEd20.dll' )
What is the value, other than 0?