i2c Posted March 26, 2007 Report Share Posted March 26, 2007 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 Quote Link to comment
AdamRofer Posted March 27, 2007 Report Share Posted March 27, 2007 QUOTE(i2c @ Mar 25 2007, 03:23 PM) 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 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. Quote Link to comment
Yair Posted March 27, 2007 Report Share Posted March 27, 2007 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.