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 intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

Building and Running the Sample

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.

Classes and Keywords

  • This sample demonstrates the following MFC class:

    CDHtmlDialog

  • 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

Note

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.

See Also

Other Resources

MFC Samples