我在下面的代码中尝试初始化我创建的DLL中的CMSChart。当它到达myChart-> CreateControl时,出于某种原因,它正在启动Windows Installer对话框,并无限期地说“准备安装......”。我不再能够使用此DLL,因为弹出此安装对话框并且永不退出。 CreateControl启动Windows安装程序对话框的原因是什么?
CMSChart *myChart = new CMSChart();
if( myChart )
{
RECT rect;
rect.left = rect.top = 0;
rect.right = rect.bottom = 10;
//Create the control and makre sure it actually creates the window
if( !myChart->CreateControl(myChart->GetClsid(), _T("Whatever"), WS_POPUP, rect, CWnd::GetDesktopWindow(), 99) ||
!myChart->m_hWnd )
{
HINSTANCE dllInst = LoadLibrary( _T("MSCHRT20.OCX") );
HRESULT rc = 0;
if( dllInst )
{
typedef HRESULT (*STDAPIFUNC) (void);
STDAPIFUNC registerServerEntry = (STDAPIFUNC) GetProcAddress( dllInst, "DllRegisterServer" );
if( registerServerEntry )
registerServerEntry();
FreeLibrary( dllInst );
}
}
delete myChart;
}