DLL中的窗体加入一个Active X后,创建窗体失败解决方法

DLL中的窗体加入一个Active X后,创建窗体失败
如果窗体上没有放ActiveX,窗体能够正常创建。按照网上搜索的说法,在App:InitInstance()函数里面加入AfxEnableControlContainer以后就可以创建了,但我加了也不行。
不是ActiveX有问题,随便拖一个DBGrid也不行
代码如下:

BOOL   CIOEWrapperApp::InitInstance()  
{
AfxEnableControlContainer();

if   (m_ioeMain   ==   NULL)
{
m_ioeMain   =   new   CIOEMain2();
BOOL   ret   =   m_ioeMain-> Create(IDD_IOEMAIN2_DIALOG);
if   (!ret)
AfxMessageBox( "Error   create   dialog ");
else
m_ioeMain-> ShowWindow(SW_SHOW);
}
return   CWinApp::InitInstance();
}


------解决方案--------------------
控件没注册吧
------解决方案--------------------
1、创建窗体的函数不要放在初始化函数里
2、在接口函数里:

{
AfxEnableControlContainer();

if (m_ioeMain == NULL)
{
m_ioeMain = new CIOEMain2();
BOOL ret = m_ioeMain-> Create(IDD_IOEMAIN2_DIALOG, hMainWnd);
if (!ret)
AfxMessageBox( "Error create dialog ");
else
m_ioeMain-> ShowWindow(SW_SHOW);
}
return true;
}

hMainWnd--> 传过来的应用程序窗口句柄
------解决方案--------------------
楼上正解
------解决方案--------------------
ActiveX就是基于Com的技术。
------解决方案--------------------
呵呵,CoInitialize(NULL);
就是这样