Call this member function to create a modeless dialog box from a dialog-box template in memory.
virtual BOOL CreateIndirect( LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd = NULL, void* lpDialogInit = NULL ); virtual BOOL CreateIndirect( HGLOBAL hDialogTemplate, CWnd* pParentWnd = NULL );
The CreateIndirect member function returns immediately after it creates the dialog box.
Use the WS_VISIBLE style in the dialog-box template if the dialog box should appear when the parent window is created. Otherwise, you must call ShowWindow to cause it to appear. For more information on how you can specify other dialog-box styles in the template, see the DLGTEMPLATE structure in the Windows SDK.
Use the CWnd::DestroyWindow function to destroy a dialog box created by the CreateIndirect function.
Dialog boxes that contain ActiveX controls require additional information provided in a DLGINIT resource. For more information, see Knowledge Base article Q231591, " HOWTO: Use a Dialog Template to Create a MFC Dialog with an ActiveX Control." Knowledge Base articles are available in the MSDN Library Visual Studio documentation or at http://support.microsoft.com.