This documentation is archived and is not being maintained.

DHtmlExplore Sample: Demonstrates Using MFC DHtml Classes

The DHtmlExplore sample shows how to use the CDHtmlDialog class with HTML resources. It also demonstrates how to handle dynamic HTML (DHTML) events and how to use DHTML dynamic data exchange (DDX).

Security noteSecurity Note:

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To get samples and instructions for installing them:

  • On the Visual Studio Help menu, click Samples.

    For more information, see Visual Studio Samples.

  • The most recent version and complete list of samples is available online from the Visual Studio 2008 Samples page.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied into a folder under \Program Files\Visual Studio 9.0\Samples\. For Express editions of Visual Studio, all samples are located online.

To build and run the DHtmlExplore sample

  1. Open the solution DHtmlExplore.sln.

  2. On the Build menu, click Build.

  3. Run the application DHtmlExplore.exe.

  4. Click the Browse button to select a directory. The dialog box is updated with the contents of the directory.

  5. Click a folder or a file to open it. Clicking the folder named ".." moves up one directory. Clicking on the folder named "." refreshes the current directory.

  6. Right-click an element to display the shortcut menu. Selecting Browse from the shortcut menu has the same effect as clicking the Browse button. Selecting Properties from the shortcut menu after right-clicking a folder or file displays a DHTML dialog box that presents the properties of the selected folder or file.

  • This sample demonstrates the following MFC class:


  • This sample demonstrates the following keywords:

    CDHtmlDialog::OnDocumentComplete; CDHtmlDialog::LoadFromResource; CDHtmlHostHandler::SetHostFlags; CDHtmlHostHandler::ShowContextMenu; CDialog::DoDataExchange; DECLARE_DHTML_EVENT_MAP; BEGIN_DHTML_EVENT_MAP; CDialog::DoModal; CDialog::OnInitDialog; CDHtmlDialog::OnInitDialog; DDX_DHtml_ElementInnerText; DDX_DHtml_CheckBox; DHTML_EVENT_ONCLICK; DHTML_EVENT_CLASS; CDHtmlEventHandler::GetElementInterface


Some samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.

Other Resources