感谢您使用微软产品。Winocc.cpp 345行是ASSERT(m_pCtrlSite != NULL); m_pCtrlSite是COleControlSite类型。 这说明datagrid control现在还不是一个ActiveX控件或没有创建。请确认以下几点:
1. 在App类InitInstance中调用了AfxEnableControlContainer();
2. 在Winocc.cpp中void CWnd::AttachControlSite(CHandleMap* pMap)设断点检查。以下网页可能有所帮助:
Q151804 PRB: Dynamic Creation of Redistributable Control Fails
http://support.microsoft.com/support/kb/articles/q151/8/04.aspQ229029 SAMPLE: AdoDataGrid.exe Demonstrates Using ADO with DataGrid
http://support.microsoft.com/support/kb/articles/q229/0/29.asp另外, 如有代码段演示错误, 也许会有帮助。- 微软全球技术中心 VC技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。