(*) I have a MFC DLL with XApp as the only App object
(*) This dll contains a class Cy which is exported as a whole using __declspec(dllexport) .
(*) Another class Cz is also defined whose base class is CDialog.
(*) Cz's dialog box has some buttons and an Active X control.
(*) Cy contains a function Function1 that instanciates Cz and calls the DoModal funtcion of it.
Now I have a exe file which statically links the dll file, instantiates the Cy class and calls Function1.
The trouble starts here. The DoModal calls return -1 (Error), whenever the dialog box contains Active X controls. When the Active X Controls are removed, the DoModal works fine. I have used the "AfxEnableControlContainer()" in the InitInstance() function of XApp.