cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Accessing Properties/Methods of a Derived Class of the Object Reference

Accessing Properties/Methods of a Derived Class of the Object Reference

I am trying to access a proprietary DLL for controller memory access over CAN. Please see attached the VI that scans the network and lists the controller addresses.

 

 

In the picture below, inside the for loop, I am trying to access the methods in the JDMemAccessController Class which is a derived class from the JDController Class. So, I am trying to type cast the variant object I receive to a object of type JDMemAccessController (as mentioned in this Link)

 

Typecast.jpg

 

However, JDMemAccessController is a dependent object and not a creatable object (as specified in this link ). So, my automation refnum is pointing to the incorrect class. Therefore, I am not able to type cast it to the correct derived class as mentioned above.

 

In C#, the code for this looks as simple as this

Controller = Network.Controllers[index] as JDMemAccessController;

 

Has anyone encountered a similar problem or suggest a possible work-around?

 

Thanks,

0 Kudos
Message 1 of 2
(109 Views)

Re: Accessing Properties/Methods of a Derived Class of the Object Reference

Hi Madan,

 

That is quite a doozy of an issue!

 

I think that the best way to do this, especially since you already know the C# code, would be to write a C# function to return a reference, instead of a variant.  Then you can compile this C# code into a dll and the call it from LabVIEW.

 

Have a great day,

 

Chris V

Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(88 Views)