CDialogImpl

template< class T >
class CDialogImpl : public CDialogImplBase

Parameters

T Your class, derived from CDialogImpl.

CDialogImpl allows you to create a modal or modeless dialog box. CDialogImpl provides the dialog box procedure, which uses the default message map to direct messages to the appropriate handlers.

CDialogImpl derives from CDialogImplBase, which in turn derives from CWindow and CMessageMap.

Note Your class must define an IDD member that specifies the dialog template resource ID. For example, the ATL Object Wizard automatically adds the following line to your class:

enum { IDD = IDD_MYDIALOG };

where MyDialog is the Short name entered in the wizard's Names page.

For more information aboutSee
Creating controlsATL Tutorial
Using dialog boxes in ATLATL Window Classes
ATL Object WizardCreating an ATL Project
Dialog boxes"Dialog Boxes" and subsequent topics in the Win32 SDK

#include <atlwin.h>

See Also BEGIN_MSG_MAP


CDialogImpl Class Members

Methods
CreateCreates a modeless dialog box.
DoModalCreates a modal dialog box.
CDialogImplBase Methods
DialogProcProcesses messages sent to the dialog box.
EndDialogDestroys a modal dialog box.

CDialogImpl Overview


Methods


CDialogImpl::Create

HWND Create( HWND hWndParent );

Return Value

The handle to the newly created dialog box.

Parameters

hWndParent [in] The handle to the owner window.

Remarks

Creates a modeless dialog box. This dialog box is automatically attached to the CDialogImpl object.

To create a modal dialog box, call DoModal.

CDialogImpl Overview | Class Members

See Also CWindow::m_hWnd


CDialogImpl::DialogProc

static BOOL CALLBACK DialogProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );

Return Value

TRUE if the message is processed; otherwise, FALSE.

Parameters

hWnd [in] The handle to the dialog box.

uMsg [in] The message sent to the dialog box.

wParam [in] Additional message-specific information.

lParam [in] Additional message-specific information.

Remarks

This static method implements the dialog box procedure. DialogProc uses the default message map to direct messages to the appropriate handlers.

You can override DialogProc to provide a different mechanism for handling messages.

CDialogImpl Overview | Class Members

See Also BEGIN_MSG_MAP


CDialogImpl::DoModal

int DoModal( HWND hWndParent = ::GetActiveWindow( ) );

Return Value

If successful, the value of the nRetCode parameter specified in the call to EndDialog. Otherwise, -1.

Parameters

hWndParent [in] The handle to the owner window. The default value is the return value of the GetActiveWindow Win32 function.

Remarks

Creates a modal dialog box. This dialog box is automatically attached to the CDialogImpl object.

To create a modeless dialog box, call Create.

CDialogImpl Overview | Class Members

See Also CWindow::m_hWnd


CDialogImpl::EndDialog

BOOL EndDialog( int nRetCode );

Return Value

TRUE if the dialog box is destroyed; otherwise, FALSE.

Parameters

nRetCode [in] The value to be returned by CDialogImpl::DoModal.

Remarks

Destroys a modal dialog box. EndDialog must be called through the dialog procedure. After the dialog box is destroyed, Windows uses the value of nRetCode as the return value for DoModal, which created the dialog box.

Note Do not call EndDialog to destroy a modeless dialog box. Call CWindow::DestroyWindow instead.

CDialogImpl Overview | Class Members

See Also CDialogImpl::DialogProc