Internet Explorer 5.5 Demos : Editing Glyphs (IE 5.5)
Description: Editing glyphs are images that represent the tags formatting a Web page. Editing glyphs give users visual clues about the structure of a page, and enable users to do more precise editing
February 18, 2002
Description: Editing glyphs are images that represent the tags formatting a Web page. Editing glyphs give users visual clues about the structure of a page, and enable users to do more precise editing than they could without glyphs. The MSHTML Editor enables you to represent most tags with your own custom images. However, some tags can't have glyph images. For instance, a TABLE tag can be assigned an image to show where the table as a whole is anchored in the document, but images cannot be assigned to the tags that format within the table, like TD and TH. Custom glyphs can only be used from C++, and work only when DesignMode is "On."
More Details
The sample for this tutorial shows how to use custom editing glyphs in an application. It demonstrates the most important implementation details to consider:
How to use IOleCommandTarget::Exec to specify images to display for specific tags.
How to format the string data that IOleCommandTarget::Exec needs. How to use image resources in a dynamic-link library (DLL) or executable program to store the images for the editing glyphs. The specifications of this behavior:
This sample is a simple browser implementation with an address bar and three buttons.
The first button turns design mode on and off.
The second button turns the custom editing glyphs on and off.
The third button turns the default editing glyphs on and off.
Important You must download the sample to your own computer to run it.
The source code for this sample is included in a Microsoft Visual C++ 6 workspace. It uses ATL to provide COM support, standard implementations of some of the standard interfaces, and "smart" interface pointers that handle their own reference counting.
Many of the interface pointers in the sample are wrapped by the CComQIPtr class. CComQIPtr is a "smart" pointer class. Besides automatic reference counting, it provides overloaded operators to make working with COM easier. CComQIPtr includes an overloaded assignment operator (operator=) which performs an automatic QueryInterface during assignment. For instance, the sample's QueryInterface call to initialize its IOleCommandTarget pointer looks like this:
// m_spWebBrowser is an already-initialized pointer to an IWebBrowser2 interface.
// m_spOleCmdTarg is a declared but uninitialized CComQIPtr for an IOleCommandTarget interface.
m_spOleCmdTarg = m_spWebBrowser;
Browser/Platform Compatibility
The Editing Glyphs sample requires Microsoft Internet Explorer 5.5 or later on the Win32 platform. For developers, header and library files for Internet Explorer 5.5 or later are needed for use in your development environment; in particular, Mshtml.h and Mshtmcid.h are necessary.
Usage
Note You will need to include the Windows 2000 Headers and Libraries from the Platform SDK in your development path when building this sample.
About the Author
You May Also Like