From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-06-2012 02:36 PM
I am trying to call a method in an ActiveX class Cayman.ICaymanMachineInfo as shown below.
Unfortunately the object is not listed as creatable. Is there anyway to work around this and be able to use the method?
There is a creatable object similar to the ICaymanMachineInfo called ICayman:
but this does not provide access to the method I need for my project. Any thoughts on how I might be able to proceed?
Thanks,
Solved! Go to Solution.
02-06-2012 03:56 PM
02-07-2012 07:15 AM
Thanks for the reply!
I checked each of the available methods and none of them return an ICaymanMachineInfo object. I have examples of code written in visual c++ that uses the same type library (as far as I can tell, this particular project hasn't been tackled in LabVIEW before). The only reference to the ICaymanMachineInfo is this:
class ICaymanMachineInfo : public COleDispatchDriver
{
public:
ICaymanMachineInfo() {} // Ruft den Standardkonstruktor für COleDispatchDriver auf
ICaymanMachineInfo(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
ICaymanMachineInfo(const ICaymanMachineInfo& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attribute
public:
// Operationen
public:
void OnStateChanged(short p__sState);
void OnUserDefinedCommandSelected(short p__sCommandID);
void OnSetUserDefinedCommand(short p__sMenuID);
};
I don't know if that helps with creating an object in LabVIEW. I am lost when it comes to traditional programming, so I am not sure how to proceed.
Thanks,
02-07-2012 08:32 AM
ICaymanMachineInfo() {} // Ruft den Standardkonstruktor für COleDispatchDriver auf
is the constructor for the class
02-07-2012 08:45 AM
Ok, so how can I implement that into my labview code?
02-08-2012 01:00 AM
I would try the constructor node. I am not sure it works though, as it is meant for .NET?
Maybe you have to use a "call library function".
02-08-2012 08:05 AM
I thought the constructor node was going to work once I looked into it a little bit. But unfortunately the constructor node won't accept my library.
I tried call library function and that kept giving me an error and force closing labview.
I am starting to think that my problem may be arising from the library file I am using. it is a tlb file. I am attaching the file in hopes that someone on here can see something I am missing with the file. I had to zip the file since labview doesn't allow me to attach .tlb files.
It looks like if the file were a dll, I would have much more success with using the file.
02-08-2012 08:20 AM
Below is what I am able to get. Is this what you are expecting?
02-08-2012 08:55 AM
That much I am able to get myself. If you notice that when you select the cayman.tlb, it shows three items in the Select Object from Library dialog:
ICayman
ICaymanMachineInfo
Wirelist (Cayman.Wirelist)
However, only the Wirelist object is creatable (and therefore is the only one I can use). I am trying to access a method inside of the ICaymanMachineInfo object:
It returns an error saying that the object isn't creatable, and I have seen some people have been able to specify a method that returns an object that creates the desired object which allows them to access the desired methods, but I haven't been able to find a method that returns an object that I can use.
02-08-2012 10:19 AM
I added the reference to the Cayman.tlb in a Visual Basic 6 project.
OnSetUserDefinedCommand, OnStateChanged, and OnUserDefinedCommandSelected shows up as events
Event OnSetUserDefinedCommand(p__sMenuID As Integer)
Event OnStateChanged(p__sState As Integer)
Event OnUserDefinedCommandSelected(p__sCommandID As Integer)