Reply

Problem in accessing variables in VC2008

[ Edited ]

 

Hi,

I have written code to read the variables from variable table.I am able to read all the variables properly when I build my code in VC6.Recently I have migrated to VC 2008 and now Iam unable to access the variables .In my code which I have pasted below,  vlist_count returns  the correct value but pVar returns null.Please help me out.

IDispatchPtr vList_Disp = PtrAllVar->Query(pFindCriterium);

VariableListPtr vList = (VariableListPtr)vList_Disp;

 

 long vlist_count = vList->Count;

 

{

 for(long i=1;i

variablePtr pVar;

 

 

pVar = vList->Item(i);

---

---

Regards,

Triadiantry{

SolidEdgeFramework::VariablesPtr

PtrAllVar=pPrtDoc->GetVariables();

 

Posted by: Shafi Shaik
Post date: 12/6/2009 10:07:51 PM

2 REPLIES

RE: Problem in accessing variables in VC2008

[ Edited ]

 

There was a mistake in my previous code snippet .The correct one is as follows: Dimensions are not accessible in VC++ 2008,and works fine in VC6.

SolidEdgeFramework::VariablesPtr PtrAllVar=pPrtDoc->GetVariables();

IDispatchPtr vList_Disp = PtrAllVar->Query(pFindCriterium);

VariableListPtr vList = (VariableListPtr)vList_Disp;

 

long vlist_count = vList->Count;

for(long i=1;i

{

variablePtr pVar;

try{

  pVar = vList->Item(i);

---

---

}

Regards.

 

Posted by: Shafi Shaik
Post date: 12/7/2009 8:43:14 PM

RE: Problem in accessing variables in VC2008

[ Edited ]

 

Triadian,

the items in the VariableList may be either of type Variable or Dimension. So you may try this:

if (NULL == pVar)

{

  DimensionPtr pDim = vList->Item(i);

  // do something with Dimension

}

else

{

  // do something with Variable

}

 

 

 

Posted by: Martin Bernhard
Post date: 12/11/2009 10:42:17 AM