problem about using ActiveX in DLL
-
in my regular MFC dll project, i create a dialog resource assoicated with a class CTestDlg, and it can normally show in my client application which uses the dll. But after i added a ActiveX control(IE Control, for example), the dialog can't be displayed and if i call a method of the ActiveX control, the debug assert failed dialog will appear: ASSERT(m_pCtrlSite!=NULL) fails. so how can i use ActiveX control correctly in DLL? thanks.
-
in my regular MFC dll project, i create a dialog resource assoicated with a class CTestDlg, and it can normally show in my client application which uses the dll. But after i added a ActiveX control(IE Control, for example), the dialog can't be displayed and if i call a method of the ActiveX control, the debug assert failed dialog will appear: ASSERT(m_pCtrlSite!=NULL) fails. so how can i use ActiveX control correctly in DLL? thanks.
Make sure you call AfxEnableControlContainer() before using any ActiveX control.
-
Make sure you call AfxEnableControlContainer() before using any ActiveX control.
-
Thanks i have already called AfxEnableControlContainer() in the InitIntstance in the dll project, but still get the same problem...
Make sure also your activeX control is registered (I know this sounds like a stupid suggestion but you will have these kind of results if your ActiveX is not registered).
-
Make sure also your activeX control is registered (I know this sounds like a stupid suggestion but you will have these kind of results if your ActiveX is not registered).
Thanks, but i use the IE control and i think it must be registered,:) i have got the solution from a forum: HRESULT hr = OleInitialize(NULL); if (hr == S_FALSE) { OleUninitialize(); } // Call if using OLE Controls AfxEnableControlContainer(); // Register all OLE server (factories) as running. This enables the // OLE libraries to create objects from other applications. COleObjectFactory::RegisterAll(); Thanks anyway~