Quantcast
Channel: Mentor Graphics Communities: Message List
Viewing all articles
Browse latest Browse all 4541

Re: Automation using C or C++

$
0
0

Hi,

because C and C++ are unmanaged UNIX-based compilers, it is very different and complicated to convert a COM interface from VB or C# into C++.

I want to create C++ program with Viewdraw.Application as well. It took me days of trying and investigating until I got a little program.

 

If it is helpful for you to see how it is generally working, please tell me how to upload the project as a ZIP file.

I am new in this community and cannot find an upload buttom.

 

But I got a serious problem casting a IVdObjs list into a single IVdComp object.

Can anybody help me, what is wrong in my code?

Everything else is working.

 

         if (!SUCCEEDED (objects->get_Count (&objCnt)))

            continue;

 

         for (int objIdx = 1; objIdx <= objCnt; objIdx++) {

            // The objects seems to be okay, because this works:

            VdObjectType objType;

            objects->GetType (objIdx, &objType);

            _tprintf (_T("DBG: objType = '%d'\n"), (int)objType);

 

            // To get the comp object seems to work:

            CComPtr<IVdComp> comp = NULL;

            if (SUCCEEDED (objects->Item (objIdx, (IDispatch**)&comp))) {

 

               // But all methods with this objects fail, like this:

               int id = 0;

               comp->get_Id (&id);

            }

         }

 

PS: How can I change the font of the source code in this window?

 

Bye

Brösel


Viewing all articles
Browse latest Browse all 4541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>