当前位置: 代码迷 >> VC >> VisualStudio2008,MFC智能装置应用程序,添加ActiveX控件不能运行
  详细解决方案

VisualStudio2008,MFC智能装置应用程序,添加ActiveX控件不能运行

热度:9735   发布时间:2013-02-25 00:00:00.0
VisualStudio2008,MFC智能设备应用程序,添加ActiveX控件不能运行
用VisualStudio2008建立MFC智能设备应用程序(Visual C++语言),在对话框上添加ActiveX控件不能正常运行,显示错误如下
Debug Asserton Failed
Program:\Program files\xxx\xxx.exe
File:
f:\dd\vctools\vc7libsce\ship\atlmfc\src\mfc\occcont.cpp
Line:936
(Press Retry to debug the application)

对程序调试,错误定位到
C:\Program Files\Microsoft Visual Studio 9.0\VC\ce\atlmfc\src\mfc\occcont.cpp
指示有问题的地方在以下语句中
COleControlSiteOrWnd *pTemp =new COleControlSiteOrWnd(hwndCtrl,pOccDlgInfo->m_pItemInfo[i].bAutoRadioButton);
ASSERT(IsWindow(pTemp->m_hWnd));

------解决方案--------------------------------------------------------
COleControlSiteOrWnd

A group of controls begins with a control that was created with the WS_GROUP style and ends with the last control that was not created with the WS_GROUP style. 

By default, the GetNextDlgGroupItem member function returns a pointer to the next control in the group. If pWndCtl identifies the first control in the group and bPrevious is TRUE, GetNextDlgGroupItem returns a pointer to the last control in the group.

-----------------------------------------------------MSDN

是获取窗口指针失败了。至于原因,我想可能是你的群组控件没有按照上述要求创建。再有就是可能是代码写错地方了--比如在对话框的构造函数里获取控件的句柄之类的肯定会失败,因为这时候对话框尚未创建,更不用说控件了。
------解决方案--------------------------------------------------------
是没有注册那个activex控件吧。
最好拷贝到system32下,然后注册。
------解决方案--------------------------------------------------------
注册下那个activex控件
  相关解决方案