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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Working with ActiveX object that is not creatable in Labview

Solved!
Go to solution

I am trying to call a method in an ActiveX class Cayman.ICaymanMachineInfo as shown below.

 

Cayman.PNG

 

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:

Cayman2.PNG

 

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,

0 Kudos
Message 1 of 12
(3,565 Views)
Don't know anything about your ActiveX classes but:
Maybe there's a method in the Icayman class, that returns an ICaymanMachineInfo object? Something like ICayman.NewMachineInfo, or ICayman.GetMachineInfo.
0 Kudos
Message 2 of 12
(3,556 Views)

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,

0 Kudos
Message 3 of 12
(3,541 Views)

ICaymanMachineInfo() {}  // Ruft den Standardkonstruktor für COleDispatchDriver auf


is the constructor for the class

0 Kudos
Message 4 of 12
(3,532 Views)

Ok, so how can I implement that into my labview code?

0 Kudos
Message 5 of 12
(3,530 Views)

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".

0 Kudos
Message 6 of 12
(3,509 Views)

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.

error.PNG

I tried call library function and that kept giving me an error and force closing labview.

 

Cayman.PNG

 

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.

 

0 Kudos
Message 7 of 12
(3,499 Views)

Below is what I am able to get. Is this what you are expecting?

 

 

cayman.jpg

0 Kudos
Message 8 of 12
(3,493 Views)

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)

Select Object.PNG

 

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:

 

Error.PNG

 

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.

0 Kudos
Message 9 of 12
(3,490 Views)

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)

 


 

0 Kudos
Message 10 of 12
(3,479 Views)