Compartilhar via


CMultiPageDHtmlDialog Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMultiPageDHtmlDialog Class.

A multipage dialog displays multiple HTML pages sequentially and handles the events from each page.

Syntax

class CMultiPageDHtmlDialog : public CDHtmlDialog  

Members

Public Constructors

Name Description
CMultiPageDHtmlDialog::CMultiPageDHtmlDialog Constructs a multipage (wizard-style) DHTML dialog object.
CMultiPageDHtmlDialog::~CMultiPageDHtmlDialog Destroys a multipage DHTML dialog object.

Remarks

The mechanism for doing this is a DHTML and URL event map, which contains embedded event maps for each page.

Example

This multipage dialog assumes three HTML resources that define simple wizard-like functionality. The first page has a Next button, the second a Prev and Next button, and the third a Prev button. When one of the buttons is pressed, a handler function calls CDHtmlDialog::LoadFromResource to load the appropriate new page.

The pertinent parts of the class declaration (in CMyMultiPageDlg.h):

class CMyMultiPageDlg : public CMultiPageDHtmlDialog
{
public:
   // Declare the DHTML event handlers:
   HRESULT OnPage1Next(IHTMLElement *pElement);
   HRESULT OnPage2Next(IHTMLElement *pElement);
   HRESULT OnPage2Back(IHTMLElement *pElement);
   HRESULT OnPage3Back(IHTMLElement *pElement);

   DECLARE_DHTML_URL_EVENT_MAP()
   
   // rest of class declaration omitted

The pertinent parts of the class implementation (in CMyMultipageDlg.cpp):

BEGIN_DHTML_URL_EVENT_MAP(CMyMultiPageDlg)

   BEGIN_EMBED_DHTML_EVENT_MAP(CMyMultiPageDlg, Page1)
      DHTML_EVENT_ONCLICK(_T("Next"), OnPage1Next)
   END_EMBED_DHTML_EVENT_MAP()

   BEGIN_EMBED_DHTML_EVENT_MAP(CMyMultiPageDlg, Page2)
      DHTML_EVENT_ONCLICK(_T("Back"), OnPage2Back)
      DHTML_EVENT_ONCLICK(_T("Next"), OnPage2Next)
   END_EMBED_DHTML_EVENT_MAP()

   BEGIN_EMBED_DHTML_EVENT_MAP(CMyMultiPageDlg, Page3)
      DHTML_EVENT_ONCLICK(_T("Back"), OnPage3Back)
   END_EMBED_DHTML_EVENT_MAP()

   BEGIN_URL_ENTRIES(CMyMultiPageDlg)
      URL_EVENT_ENTRY(CMyMultiPageDlg, _T("153"), Page1)
      URL_EVENT_ENTRY(CMyMultiPageDlg, _T("154"), Page2)
      URL_EVENT_ENTRY(CMyMultiPageDlg, _T("155"), Page3)
      // Note: IDR_PAGE1 = 153, IDR_PAGE2 = 154, IDR_PAGE3 = 155
   END_URL_ENTRIES()

END_DHTML_URL_EVENT_MAP(CMyMultiPageDlg)

HRESULT CMyMultiPageDlg::OnPage1Next(IHTMLElement *pElement)
{
   UNREFERENCED_PARAMETER(pElement);
   LoadFromResource(IDR_PAGE2);
   return S_OK;
}

HRESULT CMyMultiPageDlg::OnPage2Next(IHTMLElement *pElement)
{
   UNREFERENCED_PARAMETER(pElement);
   LoadFromResource(IDR_PAGE3);
   return S_OK;
}

HRESULT CMyMultiPageDlg::OnPage2Back(IHTMLElement *pElement)
{
   UNREFERENCED_PARAMETER(pElement);
   LoadFromResource(IDR_PAGE1);
   return S_OK;
}

HRESULT CMyMultiPageDlg::OnPage3Back(IHTMLElement *pElement)
{
   UNREFERENCED_PARAMETER(pElement);
   LoadFromResource(IDR_PAGE2);
   return S_OK;
}

Inheritance Hierarchy

CObject

CDHtmlSinkHandlerBase2

CDHtmlSinkHandlerBase1

CCmdTarget

CDHtmlSinkHandler

CWnd

CDHtmlEventSink

CDialog

CDHtmlDialog

CMultiPageDHtmlDialog

Requirements

Header: afxdhtml.h

CMultiPageDHtmlDialog::CMultiPageDHtmlDialog

Constructs a multipage (wizard-style) DHTML dialog object.

CMultiPageDHtmlDialog(
    LPCTSTR lpszTemplateName,  
    LPCTSTR szHtmlResID = NULL,  
    CWnd* pParentWnd = NULL);

 
CMultiPageDHtmlDialog(
    UINT nIDTemplate,  
    UINT nHtmlResID = 0,  
    CWnd* pParentWnd = NULL);  
  
CMultiPageDHtmlDialog();

Parameters

lpszTemplateName
The null-terminated string that is the name of a dialog-box template resource.

szHtmlResID
The null-terminated string that is the name of an HTML resource.

pParentWnd
A pointer to the parent or owner window object (of type CWnd) to which the dialog object belongs. If it is NULL, the dialog object's parent window is set to the main application window.

nIDTemplate
Contains the ID number of a dialog-box template resource.

nHtmlResID
Contains the ID number of an HTML resource.

CMultiPageDHtmlDialog::~CMultiPageDHtmlDialog

Destroys a multipage DHTML dialog object.

virtual ~CMultiPageDHtmlDialog();

See Also

CDHtmlDialog Class