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 about | See |
Creating controls | ATL Tutorial |
Using dialog boxes in ATL | ATL Window Classes |
ATL Object Wizard | Creating an ATL Project |
Dialog boxes | "Dialog Boxes" and subsequent topics in the Win32 SDK |
#include <atlwin.h>
See Also BEGIN_MSG_MAP
Methods | |
Create | Creates a modeless dialog box. |
DoModal | Creates a modal dialog box. |
CDialogImplBase Methods | |
DialogProc | Processes messages sent to the dialog box. |
EndDialog | Destroys a modal dialog box. |
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
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
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
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