As well known, WTL provides CHyperLinkImpl custom control implementation to use clickable hyperlink controls. Also control uses a few styles (underlining, tags, command vs. notify notifications), the main implementation is limited:
- control frequently requires static text, tooltip text and location for ShellExecute; you cannot embed all three strings into dialog template control’s window text so you need an additional resource strings separated from the control definition
- you cannot have two or more links per control
- you can mix clickable text with unclickable, however this style is underimplemented: text wrap is not supported
So, CHyperLinkImpl is great when you have nothing, but you are likely to still want more. Here goes more.
CHyperStatic class implements a custom control with possibly multiple anchors, support for A tag with ID, HREF and TITLE atributes:
- ID value allows to identify clicked anchor in WM_NOTIFY notification
- HREF value is a placeholder for ShellExecute argument; the control may call it automatically or you have an option to cancel this behavior in a notification callback
- TITLE value defines tooltip text
The control does supports multiline wrapping.
Note for “WTL without ATL” development: the implementation is dependent on ATL in CAtlArray class (atlcoll.h, may be reworked using CSimpleArray) and ATL regular expressions (atlrx.h, may be reworked using trivial string parsing).
Visual C++.NET 2005 source code can be downloaded here, compiled binary – here.