How to use a dialog template to create an MFC dialog that contains an ActiveX control (231591)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
This article was previously published under Q231591 Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003 support both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code. SUMMARY It is possible to display a dialog from either a DIALOG
resource or from a dialog template in memory. In the latter case, the dialog
template is either constructed or loaded into memory and the dialog is created
indirectly. Dialogs that contain ActiveX controls are more difficult
to create indirectly because they require additional information such as
license keys and the initial states of properties. MFC requires that this
additional information be provided as a DLGINIT resource. The Visual C++
resource editor creates this DLGINIT resource in the resource (.rc) file for
each dialog containing an ActiveX control. Both
CDialog::CreateIndirect() and CDialog::InitModalIndirect() support using
DLGINIT resources with dialog templates in memory. However, the DLGINIT
parameter is not documented and by default is set to NULL. The complete
prototypes for these functions are:
BOOL CDialog::CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd, void* lpDialogInit, HINSTANCE hInst);
BOOL CDialog::InitModalIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd = NULL,void* lpDialogInit = NULL);
Note Only the versions of these functions which take a LPCDLGTEMPLATE
as the first parameter support passing a DLGINIT resource. The versions which
take a HGLOBAL parameter do not support DLGINIT resources.
Modification Type: | Major | Last Reviewed: | 9/2/2005 |
---|
Keywords: | kbinfo kbContainer kbCtrl kbDlg kbhowto kbResource KB231591 kbAudDeveloper |
---|
|