Jump to content

ActiveX C++ for Labview


Recommended Posts

Hi

I was wondering whether anyone has any experience of creating ActiveX components for use within Labview? I'm pretty new to Labview in general but pushing ahead and quite enjoying it, yea yea so that irrelevant, but hey!

I'm pretty competent in both C++ and Visual Basic 6 so can use either of those for creating my ActiveX component.

I'm not at work at present so can't log into my NI account to search properly but I was wondering whether there were any quirks to watch out for and ideally if theres any tutorials out there that I can look at to get a better idea of how to push ahead with this more complex element of my project.

Thanks

Link to comment

QUOTE(i2c @ Mar 25 2007, 03:23 PM)

I have used quite a few ActiveX components in LabVIEW and I've discovered a few things over time:

1) In LabVIEW, always close your references; always close your references. Always close your references. If you don't then bad things might happen, like random hangs.

2) Variables (such as the TimeStamp in LV 7+, aka Date in VB6) don't always match up perfectly, so experiment before releasing stuff to other people.

3) Any problems in your ActiveX component (memory leaks, handle leaks) will still exist, so make sure you don't open a reference to a registry location without closing it.

4) If there's a "hidden" ActiveX Property/Method then you can't explicitly "call" it in LabVIEW like you might be able to in another language.

5) Using ActiveX in LabVIEW is pretty easy.

6) Play around a bit with the whole compatibility thing (binary, etc). If you upgrade a component that breaks compatibility then sometimes LabVIEW will make you go through and re-select every Property / Method you have wired up. You cannot have compatibility sometimes when you modify a Property or Method. LabVIEW will always force you to see that things have changed, so just be aware and listen to the Diagram Errors box when something won't run after you upgrade a component.

7) "regsrv32 abc.dll" and "regsrv32 -u abc.dll" are your friends (register and unregister AX components). If you don't explicitly ask VB6 or your C++ compiler to do this already, you have to make sure to (a) close LabVIEW, (b) unregister your old component, © open LabVIEW, (d) make sure things still work with the new version.

As for tutorials, the help file should have some stuff about it, but http://zone.ni.com/reference/en-XX/help/371361B-01/lvconcepts/using_activex_with_labview/' target="_blank">Here is some information on NI's site.

Link to comment

To expand on Adam's first point, LV does automatic memory management, but it can only free the memory used by the COM object automatically when you completely stop the VI, so you have to close references explicitly.

In addition, working with .net and ActiveX is a bit cumbersome, because you have to use a lot of property and invoke nodes and the code to screen-real-estate ratio sucks. Be sure to make plenty of subVIs and set the boundaries properly (each VI should be responsible for closing the references it opens).

Go read Brian Tyler's blog (Lycangeek). Brian used to head the .net team and his blog mostly dealt with that, but you should also find some ActiveX related stuff. There was an entry on the blog showing how to use scripting languages text directly in LV through .net. Maybe the same will be applicable for ActiveX.

Do a search here, in the NI forums and in Info LabVIEW to see what you can find.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.