LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I access an ActiveX control's interface when have its generic control refnum in hand?

Hi all,

 

I am scanning a front panel for controls.  In that front panel, there is an active x control (may have a few).  I want to interrogate that control for ones that have a compatible interface and access that interface.  Going to a more specific class doesn't work, and using a cast just causes the code to go nowhere when it enters a property or invoke node.  Is there a way to do this?

 

I'm using LV 7.0 under Win XP.

 

Thanks,

 

 

Adrian

Message Edited by Been bitten by LabVIEW on 11-19-2008 09:38 AM
0 Kudos
Message 1 of 31
(4,147 Views)

Been bitten by LabVIEW wrote:

Hi all,

 

I am scanning a front panel for controls.  In that front panel, there is an active x control (may have a few).  I want to interrogate that control for ones that have a compatible interface and access that interface.  Going to a more specific class doesn't work, and using a cast just causes the code to go nowhere when it enters a property or invoke node.  Is there a way to do this?

 

I'm using LV 7.0 under Win XP.

 

Thanks,

 

 

Adrian

Message Edited by Been bitten by LabVIEW on 11-19-2008 09:38 AM

Just a thought...

 

Would check ing the error code returned by the "To more Specific" help with a "trial and error approach"? There is an example of this approach used in my Nugget on using Control references.

 

Just trying to help,

 

Ben

Message Edited by Ben on 11-19-2008 09:52 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 31
(4,135 Views)
That was my orignial thought of how I was going to do this, but if I pass a constant or a ref to an ActiveX control that has the interface I was going to test for, it gives me an error (wire conflict).  I'll check your link to see if there is anything else I've missed.
0 Kudos
Message 3 of 31
(4,130 Views)
The To More Specific Class only applies to LabVIEW classes, so I don't think it's going to do you any good in determining the ActiveX class. One thing that's not clear from your description is whether you're dealing with ActiveX containers, or an ActiveX reference control.
0 Kudos
Message 4 of 31
(4,128 Views)

Yeah, you've basicly have done what I've done already, except for regular LV controls, I use the class name instead of using the "To More Specific Class" node to try and test.  I beleive that it (using "To More Specific Class" to test) was slowing down the process and causing the mouse cursor to flash.

 

And as I've stated in my previous post, this doesn't work for ActiveX controls.  Thanks anyway.

 

Any other suggestions?

 

 

Adrian

Message Edited by Been bitten by LabVIEW on 11-19-2008 10:17 AM
0 Kudos
Message 5 of 31
(4,126 Views)

Please state what you mean and what the difference is between "ActiveX containers" and "ActiveX reference control".

 

Thanks

0 Kudos
Message 6 of 31
(4,123 Views)

Been bitten by LabVIEW wrote:

Yeah, you've basicly have done what I've done already, except for regular LV controls, I use the class name instead of using the "To More Specific Class" node to try and test.  I beleive that it was slowing down the process and causing the mouse cursor to flash.

 

And as I've stated in my previous post, this doesn't work for ActiveX controls.  Thanks anyway.

 

Any other suggestions?

 

 

Adrian


Does that indicate you have a method that works but you are un-happy with the flashing? If so you could scan the FP once when it starts and cahce your finding for use latter.

 

Take care,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 31
(4,118 Views)

Been bitten by LabVIEW wrote:

Please state what you mean and what the difference is between "ActiveX containers" and "ActiveX reference control".


The ActiveX container is a container that houses an ActiveX control on the front panel. The ActiveX reference control is the Automation refnum control in which you use the Automation Open function to create the ActiveX class.

0 Kudos
Message 8 of 31
(4,115 Views)

I wrote a bunch of code to scan all the controls on a FP and if they were found within the FP rect, to capture the text.  It did this by scanning the FP for all the controls grab all of the text and font info from each control depending on type of control it is, and writing all of this data to a file.  It works fine, except for ActiveX controls.  I want the same scanning routine to work for them if possible by exposing a particular property that would send a 2D array of property name/value pairs which my code will be able to interpret.

 

This requires that I am able to interrogate the type of ActiveX control and access its interface given the control refnum.

 

This should be a simple thing, but I've found that simple is not necessarily synonymous to LV :(, at least in LV 7.0, maybe it gets better in LV 8.  Don't get me wrong, LV is great for some things, but I feel that is a bit crippled compared to some other languages and libraries I've used in the past.

 

Adrian

0 Kudos
Message 9 of 31
(4,112 Views)

Cool thing to know.  I'll have to look in to Automation refnum controls later. 🙂 I'm using the ActiveX container that houses the ActiveX control on the front panel.

 

I'm guessing that I have to dereference the ActiveX container to get at the control somehow?

Message Edited by Been bitten by LabVIEW on 11-19-2008 10:42 AM
0 Kudos
Message 10 of 31
(4,109 Views)