I find it difficult to determine what I am doing wrong, so I thought that I would ask about it in SO. I am trying to automate the measurement task (Qualcomm QXDM), so I would like to access the COM interface exposed by the measurement tool. I wrote the following python code with works fine:
from comtypes.client import CreateObject QXDM = CreateObject("QXDM.Application") IQXDM2 = QXDM.GetIQXDM2 ...
Now I am trying to rewrite this C # due to some specific requirements that I have. Here is what I tried:
using QXDM; QXDM2Class IQXDM = new QXDM2Class();
But when I try to run this, I get:
Retrieving the COM class factory for component with CLSID {6777AAE0-D9D2-4EA7-996B-0EECC68F97D8} failed due to the following error: 80040154.
What am I doing wrong? I see all the methods and interfaces provided by QXDM in the object browser in Visual Studio.
Change Late binding seems to be the only way to do this, as Hans suggested. I changed the code to the following:
Type QXDM = Type.GetTypeFromProgID("QXDM.Application"); Object QXDMObject = Activator.CreateInstance(QXDM);
It works. The only problem is that I need to know which methods and classes are exposed to QXDM, which, I think, I could figure out using the object browser. Thanks everyone!
source share