Search Wiki:
Resource Page Description
The Safe-for-Scripting DHTML Editing control was introduced in IE 4.0 and discontinued in Windows Vista. This sample includes code for replacing it with an HTC in Windows Vista.
A whitepaper suggesting work-arounds was published at http://msdn2.microsoft.com/en-us/library/aa663363.aspx which included, among other approaches, a section on writing an HTC to emulate the Safe-for-Scripting DHTML Editing Control. This sample is an implementation matching that description, and can be used for replacing the Safe-for-Scripting DHTML Editing control in existing web applications.


PDEC: The Pseudo DHTML Editing Control


This project contains:
  • Pdec.htc, a view-linked HTML Component which simulates the Safe-for-Scripting DHTML Editing Control
  • FontDialog.htm, a simplistic font selection HTML dialog which is called from Pdec.htc
  • TestHarness.htm, a web page which can be used to host and test either the DHTML Editing Control or Pdec.htc
  • Toolbar.htc, a simplistic HTML Component toolbar used by TestHarness.htm
  • Dhtmled.js, a JavaScript "header file" declaring various constants, used by TestHarness.htm and Toolbar.htc
  • Content.htm, a sample file to be loaded by TestHarness.htm
  • An img directory, containing various GIF images

Pdec.htc is intended to be used or modified to replace the Safe-for-Scripting DHTML Editing Control in Windows Vista.
The DHTML Editing Control, composed of Dhtmled.ocx and Triedit.dll, has shipped as part of Windows since IE 4.0. It is actually two controls in one package: the Safe-for-Scripting DHTML Editing Control could be hosted in web pages and used for WYSIWYG HTML editing in web applications. There is also a DHTML Editing Control for Applications (implemented in the same binaries, but with a different GUID) which cannot be instantiated in a web page and is intended to be used as an OLE Control in OLE-aware applications, such as those built with VB or MFC.
Both controls are unavailable in Windows Vista (and later) operating systems; see Replacing the DHTML Editing Control in Windows Vista and Beyond for details.

The DHTML Editing Control for Applications version of the control has been released as a redistributable for Windows Vista and can be downloaded from: DHTML Editing Control for Applications Redistributable Package (x86) but the Safe-for-Scripting version of the control is unavailable. The article refered to in the first link describes several ways to work around the lack of availability of the control and ends with a description of how this might be accomplished using an HTML Component (HTC.) This project represents such an HTC.

A couple of notes:

  • The HTC implementation makes the PDEC IE specific. So was the DHTML Editing Control. If you're using it as a replacement, this will not be a problem.
  • The PDEC is designed to directly replace the control with as few changes as possible, but there are some differences. Property and Method names will be case-sensitive in JScript, for example.
  • The PDEC is not a complete implementation of the control's functionality: Source Code Preservation is not supported, nor is Table Editing or Z-Ordering.

You are free to modify the PDEC for your own purposes; see the license here. Your feedback on useful modifications will be appreciated.
Last edited Sep 5 2008 at 11:16 PM  by Van, version 5
Updating...
Page view tracker