I'm trying to use InitModalIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd = NULL) to create a dialog at runtime with no Resource. I'm having trouble getting it to work. I'm getting a runtime OLE crash when I call DoModal() on the object. I read that activeX controls treat InitModalIndirect() differently than regular applications but I haven't found any good (working) examples how to get it working in activeX. I have an activeX control that pops up a dialog at runtime. It works fine when I use a resource.
My current code looks like this:
Later in the program I call m_pPropDlg->DoModal();
Low and behold an OLE CRASH
My current code looks like this:
Code:
DLGTEMPLATE dlgtmplate;
dlgtmplate.style = DS_MODALFRAME | WS_CAPTION | WS_SYSMENU;
dlgtmplate.cdit = 2;
dlgtmplate.x = 0;
dlgtmplate.y = 0;
dlgtmplate.cx = 100;
dlgtmplate.cy = 100;
m_pPropDlg = new CICAPropDlg;
BOOL success = m_pPropDlg->InitModalIndirect(&dlgtmplate, NULL);
Later in the program I call m_pPropDlg->DoModal();
Low and behold an OLE CRASH