From: Louis Ferreira on
I have Animatics SmartMotors and am using their SMIEngine.dll, which is a COM dll. I'm having trouble with a particular interface called ISMICMotion. The help information for obtaining an instance of it is as follows: The client application
can obtain an instance of this interface, using the available <a href="../ISMIComm/ISMIComm%20Interface.htm" target="_blank">ISMIComm</a> interface. &nbsp; The following examples show how to obtain
this interface in Visual Basic and Visual C++.&nbsp;
In these examples CommInterface is assumed to be the available <a href="../ISMIComm/ISMIComm%20Interface.htm" target="_blank">ISMIComm</a>
interface. Visual

CMotionInterface As ISMICMotion &nbsp;&nbsp;&nbsp; &nbsp; Set
CMotionInterface = CommInterface
&nbsp;&nbsp;&nbsp; ISMICMotionPtr&nbsp;&nbsp;&nbsp; CMotionInterface;&nbsp;&nbsp;&nbsp; HRESULT
hr=CommInterface.QueryInterface(__uuidof(ISMICMotion),&amp;CMotionInterface);&nbsp;&nbsp;&nbsp; if
(FAILED(hr)) &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AfxMessageBox("The interface
\"ISMICMotion\" not found!");&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;&nbsp;&nbsp;&nbsp; }I can open a reference to the ISMICMotion interface using Automation Open but the operation of the methods from the ISMICMotion interface is dependent on the ISMIComm interface. So opening an independent reference doesn't work and the ISMIComm interface does not have anything like a GetISMICMotion reference method. Is there any way to achieve in LabVIEW what the above code does?
It seems to me that I should be able to acquire proper dependencies using only the exposed methods. Is it because the makers of the SMIEngine.dll have not followed some COM rules?thanks for you help,Louis
From: Yi Y on
Hi Louis,
From the example code that you provided, I do not see the portion as to
how to acquire the ISMIComm interface or if it's accessible.&nbsp; You would need ISMIComm to access ISMICMotion interface. LabVIEW can only access references and call methods that are exposed. From what I can gather based on the code, you need to get the reference for ISMIComm interface, find the method that gives you a reference to ISMICMotion interface, then get the reference for CommInterface, access QueryInterface method, then pass the reference to ISMICMotion as a parameter to QueryInterface. I cannot tell you how SMIEngine.dll is implimented, and it would be difficult for me to say exactly how the operation is done without familiarity with the implementation of your driver.Hope this information helps.&nbsp; Feel free to post here if you need any clarifications.Yi YanApplications