Skip navigation

Internet Explorer 5.5 Demos : Editing Commands (IE 5.5)

Description: The MSHTML Editor provides a full complement of commands that enable you to modify a document. The commands to edit a document operate on the current selection. They enable you to perform many tasks, including:
-Cutting, copying, pasting or deleting the selection.
-Changing font size or color.
-Inserting new elements.
-Finding text.
-Changing between overwriting and insertion mode.
-Creating or removing hyperlinks.
-Indenting and negative-indenting blocks.
-You can find a list of the available commands in MSHTML Command Identifiers.

The commands can be used from C++, Microsoft Visual Basic, and script. The commands also work in browse mode, though you can't edit the text in browse mode. When you execute a command, it becomes a part of the Editor's undo list, if applicable. The MSHTML Editor provides some keyboard shortcuts to execute commands: the most important of these commands are copy, cut, paste, bold, and italic.
Caution If you change a property on any element in a page, the undo list is cleared.

More Details
The samples for this tutorial demonstrate the selection editing commands controlled through IOleCommandTarget::Exec and execCommand. They show:
-How each of the features behaves.
-How to use IOleCommandTarget::Exec and execCommand to execute editing commands.
-There are two samples for this tutorial. One is an executable application developed in C++; the other is a simple Web page. The specifications are similar:

The samples are simple editor implementations with buttons and input boxes to execute commands
The first button turns the MSHTML Editor on and off.
Each of the rest of the buttons executes one of the selection editing commands. Some commands have edit boxes for input.

Browser/Platform Compatibility
The Editing Commands 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 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. The C++ sample uses ATL to provide COM support, standard implementations of some of the standard interfaces, and "smart" interface pointers that handle their own reference counting.
Note:You will need to include the Windows 2000 Headers and Libraries from the Platform SDK in your development path when building this sample.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish