iCAx开思工具箱
标题:
CAA基础求助
[打印本页]
作者:
soyaceo
时间:
2011-8-31 14:04
标题:
CAA基础求助
请问我这样来来获得CATIContainer 。但为什么总是说<<"error getting the spConODocs"<< 呢。以前这样做是可以的,现在怎么又不行了呢。
CATIContainer *DialogCommand::pSpecContainer(void)
{
CATFrmEditor* pEditor = CATFrmEditor::GetCurrentEditor();
if(!pEditor)
{
cout <<"error getting the FRM editor"<< endl;
return NULL;
}
CATDocument *pDoc = pEditor->GetDocument();
if(!pDoc )
{
cout <<"error getting the CATDocument"<< endl;
return NULL;
}
CATIContainerOfDocument_var spConODocs = NULL_var;
HRESULT rc = pDoc->QueryInterface(IID_CATIContainerOfDocument,(void**)&spConODocs) ;
if(!spConODocs)
{
cout <<"error getting the spConODocs"<< endl;
return NULL;
}
CATIContainer* pSpecContainer = NULL;
HRESULT hr = spConODocs->GetSpecContainer(pSpecContainer);
spConODocs->Release();
if(pSpecContainer == NULL_var)
{
cout <<"error getting the pSpecContainer"<< endl;
}
if(spConODocs == NULL_var)
{
cout <<"error getting the container of documents"<< endl;
}
return pSpecContainer;
}
作者:
hong3058
时间:
2011-9-2 11:25
把CATIContainerOfDocument_var spConODocs = NULL_var;
修改为CATIContainerOfDocument* spConODocs = NULL;
你下面既然有对该指针Release就不需要使用智能指针。
作者:
linlily0925
时间:
2011-9-13 14:49
spConODocs->Release();不需要,因为只能指针不需要释放~
if(pSpecContainer == NULL_var)改为if(pSpecContainer == NULL),因为pSpecContainer 你定义的是普通指针,不是智能指针~~
作者:
54qunan
时间:
2011-9-16 22:34
真好好好好好好好
作者:
soyaceo
时间:
2012-3-24 15:31
谢谢大家。
欢迎光临 iCAx开思工具箱 (https://t.icax.org/)
Powered by Discuz! X3.3