控件中动态创建控件.docxVIP

  • 2
  • 0
  • 约1.77千字
  • 约 2页
  • 2021-02-20 发布于天津
  • 举报
通过CreateControl()直接创建控件(ocx)失败时的处理收藏 刚开始的时候,在一个对话框工程 exe 中,通过 CreateControl() 可以成功地直接创建一个控 件(ocx),后来由于变化,需要在一个控件中再手动创建其它的控件,结果却失败了,创建的 代码和在 exe 中完全一样,可为什么不成功呢? 出问题的那一句是: m_pCtrlCont = afxOccManager-CreateContainer(this); 是 windows 自己的文件中,函数如下: BOOL CWnd::InitControlContainer(BOOL bCreateFromResource) { if (m_pCtrlCont == NULL) { BOOL bSuccess; bSuccess = CreateControlContainer( m_pCtrlCont ); if (bSuccess (m_pCtrlCont == NULL)) { // The window wants to use the default control container. TRY { m_pCtrlCont = afxOccManager-CreateContainer(this); } END_TRY } //When Container is created and it is

文档评论(0)

1亿VIP精品文档

相关文档