7 VOID
SetRangeFormatting(LONG Start
, LONG End
, DWORD dwEffects
)
9 CHARFORMAT2 CharFormat
;
11 SendMessageW(EM_SETSEL
, Start
, End
);
13 ZeroMemory(&CharFormat
, sizeof(CharFormat
));
15 CharFormat
.cbSize
= sizeof(CharFormat
);
16 CharFormat
.dwMask
= dwEffects
;
17 CharFormat
.dwEffects
= dwEffects
;
19 SendMessageW(EM_SETCHARFORMAT
, SCF_WORD
| SCF_SELECTION
, (LPARAM
) &CharFormat
);
21 SendMessageW(EM_SETSEL
, End
, End
+ 1);
26 GETTEXTLENGTHEX TxtLenStruct
;
28 TxtLenStruct
.flags
= GTL_NUMCHARS
;
29 TxtLenStruct
.codepage
= 1200;
31 return (LONG
) SendMessageW(EM_GETTEXTLENGTHEX
, (WPARAM
) &TxtLenStruct
, 0);
35 * Insert text (without cleaning old text)
42 VOID
InsertText(LPCWSTR lpszText
, DWORD dwEffects
)
45 LONG Len
= GetTextLen();
48 SetText
.flags
= ST_SELECTION
;
49 SetText
.codepage
= 1200;
51 SendMessageW(EM_SETTEXTEX
, (WPARAM
) &SetText
, (LPARAM
) lpszText
);
53 SetRangeFormatting(Len
, Len
+ wcslen(lpszText
),
54 (dwEffects
== CFM_LINK
) ? (PathIsURLW(lpszText
) ? dwEffects
: 0) : dwEffects
);
58 * Clear old text and add new
60 VOID
SetText(LPCWSTR lpszText
, DWORD dwEffects
)
63 InsertText(lpszText
, dwEffects
);
66 HWND
Create(HWND hwndParent
)
68 // TODO: FreeLibrary when the window is destroyed
69 LoadLibraryW(L
"riched20.dll");
71 m_hWnd
= CreateWindowExW(0,
74 WS_CHILD
| WS_VISIBLE
| ES_MULTILINE
|
75 ES_LEFT
| ES_READONLY
,
79 _AtlBaseModule
.GetModuleInstance(),
84 SendMessageW(EM_SETBKGNDCOLOR
, 0, GetSysColor(COLOR_BTNFACE
));
85 SendMessageW(WM_SETFONT
, (WPARAM
) GetStockObject(DEFAULT_GUI_FONT
), 0);
86 SendMessageW(EM_SETEVENTMASK
, 0, ENM_LINK
| ENM_MOUSEEVENTS
);
87 SendMessageW(EM_SHOWSCROLLBAR
, SB_VERT
, TRUE
);
93 virtual VOID
OnLink(ENLINK
*Link
)