LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Which ActiveX class am I using?

I have this VI that calls AutomationOpen with a constant connected to the AutomationRefnum input. How can I tell which ActiveX class is the constant actually referring to?

  If I right click and choose Properties I get nothing interesting.

  If I right click and choose "Select ActiveX class" I get a list of possibilities, but that doesn't tell me which tlb/ocx LabVIEW get the list from, and a browse option which, if selected, leads to a dialog (after LabVIEW takes it's swell time to list them) of all the ActiveX classes that it knows about somehow, but the one that the constant refers to is not selected.

If I wasn't the one that created that VI I'm now at a loss to what I'm actually using.

 

To top it off, if, on the SAME Windows 7 64 bit machine, with no updates required as far as both Windows Update and National Instruments Update Service are concerned, and with both LabVIEW 2011 64 bits and LabVIEW 2012 64 bits installed, I open that VI with those two versions of LabVIEW, I get what it looks like a constant that is referring to DIFFERENT ActiveX classes, as the list of choices, besides the "browse" option, that shows up in the "Select ActiveX class" right click menu, are DIFFERENT.

 

Worse, If I run a simple test case (but too complex to post here) with LabVIEW 2011, the code runs fine.  If I run that same code with LabVIEW 2012, it hard crashes with an exception code of 0xC0000005, which is usually a bad pointer or segmentation violation of some sort.

0 Kudos
Message 1 of 6
(3,136 Views)

When you right-click and go to Select ActiveX Class..., it should show you the class name with a checkbox next to it. Another option is to turn on the context help and put the cursor over the wire coming out of the class constant (or out of Automation Open). A third option is to make the constant's label visible. Note that the name that's shown might not actually match the name you would need to select when browsing for that class, however. For example a constant of type Excel._Application might actually be under Microsoft Excel 12.0 Object Library Version 1.6. I have no idea how you'd get that name from the class type constant.

 

EDIT: by the way, the list that shows up when you right-click and choose Select ActiveX Class is a list of recently-used classes, so they would not necessarily be the same on both versions. The currently-selected class should have a checkmark next to it in the list, though, and that should be the same on both versions.

0 Kudos
Message 2 of 6
(3,120 Views)

If I exit both LabVIEW 2011 and 2012, restart them, and open the VI where I have the automation refnum constant, right click and select active x class, the name of the selected class is the same on both instances, BUT the list of classes IS NOT.  On 2011 there is only one entry, on 2012 there are more entries.  Thus either both LabVIEW programs opened different .TLB or .DLL or whatever files, or after opening them present to me a different list.

Either way I don't seem to be able to figure out which file that class is coming from.

 

Another difference is that the reference out of the AutomationOpen call is wired to a LabVIEW Property Node and the Property selected is different, yes, the VI looks  different when opened by LV2011 and LV2012.  The class in case is ADODB._command and the Property Node on LV2011 has "_Command_Deprecated", on LV2012 has "_Command", so again, I'm either connecting to different files or the different LVs interepret the code differently. And then LabVIEW 2012 crashes.

 

If I could tell which .tlb each case is using, I could maybe point LV2012 to the same msadoXXX.tlb and see whether it runs or crashes and understand how to fix it.  Without that knowledge it is a guessing game.  I can't really open the brain of the engineer that wrote that code, if I knew where he is, and revisit what he linked the constant to.  I ought to be able to ask Labview what is going on.  I can do so when I call a DLL, the path to the DLL is right there in the code.  Maybe for a TLB is dynamically determined, but once determined I should be able to find out.

 

Not claiming that I can't, maybe I just don't know where to look.  Class names don't necessarily map to file names/paths, specially if contained in different versions of an OCX.

0 Kudos
Message 3 of 6
(3,109 Views)

@instrumento wrote:

If I exit both LabVIEW 2011 and 2012, restart them, and open the VI where I have the automation refnum constant, right click and select active x class, the name of the selected class is the same on both instances, BUT the list of classes IS NOT.  On 2011 there is only one entry, on 2012 there are more entries.  Thus either both LabVIEW programs opened different .TLB or .DLL or whatever files, or after opening them present to me a different list.


As per the late edit to my previous reply: the list that's presented is simply a list of classes that you've used recently in that version of LabVIEW. The contents of that list, other than the checked item, don't tell you anything about the class constant.

 

Unfortunately in this sort of situation I've resorted to a bit of trial-and-error - select a library from the Browse list that looks promising, and see if it contains a matching class. I don't know of any way within LabVIEW to get the path and name of an ActiveX library from the reference.

0 Kudos
Message 4 of 6
(3,104 Views)


the list that's presented is simply a list of classes that you've used recently in that version of LabVIEW. The contents of that list, other than the checked item, don't tell you anything about the class constant.



We may be saying the same thing, but in my case that list is empty when I start either LV2011 or LV2012, and after opening the one and only and same VI (and indirectly the VI hierarchy) that list is different on LV2011 and LV2012.



Unfortunately in this sort of situation I've resorted to a bit of trial-and-error - select a library from the Browse list that looks promising, and see if it contains a matching class.



I have about 8 msadoxx.tlb versions in c:\program files\common files\system\ado, another 8 in c:\program files (x86)\common files\system\ado, and then multiple copies on the winsxsx folders. I would have to not only select from the list the "select activex class" shows me, but also browse to each one of others. And probably I need to exit LV after each time. And in the end I may end up with only the illusion that I know which one I linked to and never be sure. I then I'd have to rinse and repeat when LV2013 comes along. It is not trial and error, is torture.



I don't know of any way within LabVIEW to get the path and name of an ActiveX library from the reference.



Neither do I, but someone ought to know.

0 Kudos
Message 5 of 6
(3,097 Views)

Well, I think found a way of finding this out, and I should have remembered earlier!

Install Process Explorer from microsoft/sysinternals (I have on all my machines for a long time).

Enable the lower pane view showing DLLs.

Start a fresh run of LabVIEW and open the VI with the automation refnum.

Check which DLL labview.exe opened.

 

I also found a workaround to the crash ... but there goes a few hours

0 Kudos
Message 6 of 6
(3,086 Views)