iCAx开思工具箱
标题:
solidworks中动态创建树控件问题
[打印本页]
作者:
DieDesigner
时间:
2006-6-7 16:58
标题:
solidworks中动态创建树控件问题
我写了一段代码想动态创建树控件,但是运行到 Root=pTreeCtrl.InsertItem(_T("station 1"))时出现Assertion failed错误Afxcmn.inl line:242 ASSERT(IsWindow(m_wnd)),请帮忙看看,如何解决。
谢谢了。
CComBSTR ImageFile;
CComPtr<IModelViewManager> iModelViewMgr;
CComPtr<IModelDoc2> iModelDoc;
CComPtr<IFeatMgrView> iFeatMgrView;
CComPtr<IUnknown> iUnknown;
HRESULT hr;
HTREEITEM Root;
long paneType;
CTreeView* pTreeView;
LPRECT lpRect=NULL;
VARIANT_BOOL bRet;
hr=iSwApp->get_IActiveDoc2(&iModelDoc);
hr=iModelDoc->get_ModelViewManager(&iModelViewMgr);
hr=iBmp->CreateBitmapFileFromResource(IDB_BITMAP6,&ImageFile);
hr=iModelViewMgr->CreateFeatureMgrControl2(ImageFile,_T("MSComctlLib.TreeCtrl"),_T(""),_T(""),swFeatMgrPaneTop,&iFeatMgrView);
hr=iFeatMgrView->IGetControl(&iUnknown);
hr=iUnknown->QueryInterface(IID_IOleControl,(void**)&pTreeView);
CTreeCtrl& pTreeCtrl = pTreeView->GetTreeCtrl();
Root=pTreeCtrl.InsertItem(_T("station 1"));
hr=iModelDoc->put_FeatureManagerSplitterPosition(0);
hr=iFeatMgrView->ActivateView(&paneType);
欢迎光临 iCAx开思工具箱 (https://t.icax.org/)
Powered by Discuz! X3.3