DLL中的窗体加入一个Active X后,创建窗体失败
ohahu 2007-05-17 04:56:08 如果窗体上没有放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();
}