|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Call this member function to initialize a modal dialog object using a dialog-box template that you construct in memory.
BOOL InitModalIndirect( LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd = NULL, void* lpDialogInit = NULL ); BOOL InitModalIndirect( HGLOBAL hDialogTemplate, CWnd* pParentWnd = NULL );
To create a modal dialog box indirectly, first allocate a global block of memory and fill it with the dialog box template. Then call the empty CDialog constructor to construct the dialog-box object. Next, call InitModalIndirect to store your handle to the in-memory dialog-box template. The Windows dialog box is created and displayed later, when the DoModal member function is called.
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.