Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trouble with InitModalIndirect(...)

Status
Not open for further replies.

gorgor

Programmer
Aug 15, 2002
164
US
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:
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top