What's error?

Valued Contributor
Valued Contributor

 

Hi, Jason, I want to change the variable in variable table by program with C++, but I find a question, program as following,

    pDis=pPartDoc->Variables;

 

    hr=pDis->QueryInterface(&pVars);

 

    pDis->Release();

//    hr=pVars->Edit("a","120"); /// It's OK!

    _variant_t v;

    v="a";

    hr=pVars->Item("a")->QueryInterface(&pVar); ///hr=NOINTERFACE

 

The same function in another program, the last hr's value is S_OK!

 

Could you help me?

 

Thanks!

 

Posted by: assassin 007
Post date: 1/6/2010 4:30:57 AM

1 REPLY

RE: What's error?

Valued Contributor
Valued Contributor

Hi,

I don't know about C++ but i think it could be the old problem:

In the variable table you can find "Variable" objects AND "Dimension" objects, so if you find the object with the "Query" method, you have to declare the variable that receives the object as type "Object".

If the variable is type "Variable" you will not get Dimensions and viceversa.

In your case i think i would try revising the declaration of "pVar" if i could understand your example.

 

Posted by: Julian Guillo
Post date: 1/11/2010 3:10:08 AM