LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I update my ActiveX controls without breaking existing VIs?

Hi, I'm new to LabView. I've inherited a labview application that makes use of several user-written VIS. All these vi files use an ActiveX control. For better or worse, the way they've done it is to put a ActiveX Container on the front panel. They then picked "Insert ActiveX Control", and picked the correct OCX. In the block diagram, they set up a "Invoke" Node and wire the ActiveX control to that.

The problem occurs when I update the ActiveX control. I added a couple of methods and reregistered it. When I run one of my vi files, I get:
Error 0 occurred at VI Open & Init Spinstand
Possible Reasons....

I then thought that going to the front panel and deleting the ActiveX control and reinser
ting it would work. Instead I got the message:
Error 1598667368 occurred at VI open & Init...

I should point out that I'm not even attempting to use the new function yet; I'm just running an old .vi file with the updated ActiveX control.

The version of LabView I'm using is 6.0.2. Can anyone tell me what's going on? Is there a way to gracefully update the ActiveX control? I'm I adding ActiveX controls in the best way?

Any help or references would be greatly appreciated.

Thanks,

Andrew Walker
0 Kudos
Message 1 of 7
(4,523 Views)
New ActiveX control must include same interface as old. Inner implementation of it can be changed.
0 Kudos
Message 2 of 7
(4,523 Views)
Nadav, Thanks, but in this case the interface MUST change. More functions are required in the interface.
All the old function do exist however.

Can anyone tell me what I need to change? As I stated in my original post, simply deleting the ActiveX control from the front panel and reinserting the updated one does not seem to work.

Can anyone from N.I. address the issue? I would think it's a fairly common situation.

Thanks,

Andrew
0 Kudos
Message 3 of 7
(4,523 Views)
If the new ActiveX control has a new interface, then it's actually a different ActiveX control than what was present before. This is the reason you're having troubles. The old VI was built for a particular ActiveX control with its own set of functions and implementations. If you replace that control with another one (with a different interface), then those functions will no longer work for that particular ActiveX control because there is a new ActiveX Server.

This is actually a constant problem. For example, ActiveX Servers from Microsoft Office will only work for a particular version. If you have a VI that calls the Microsoft Office 97 ActiveX Control, and then you change that to the Office 2000 Control, it will crash at run-time.

So, unfortunately, if ther
e is a new interface, you can not easily change the controls. You can try it by re-compiling the VI, but most likely you will need to rebuild the VI for your new control.
J.R. Allen
0 Kudos
Message 4 of 7
(4,523 Views)
Creat new ActiveX container and in browse option select your new ActiveX control. It must work.
0 Kudos
Message 5 of 7
(4,523 Views)
A possible solution that hasn't yet been addressed:

I am going to assume that there are two reasons that you could be using ActiveX. My second reason is what I want to lean towards:

First, you have to communicate with an outside application in Windows

Second, you aren't familiar enough with labview yet, and instead, have rewritten the code in VB and built it as an ActiveX Control.

Of course, there's probably another reason.....

If the reason is that you aren't yet familiar with LabVIEW, I would say that this is the perfect opportunity to learn. Give it a shot in LabVIEW. If you need help, say so.


Also, this is something you can try. I was able to get OCXs to update automatically, but there is a neat little trick to it. First,
DO NOT REGISTER the ocx. Instead, just put it in a folder somewhere in your directory hierarchy (you DO have a directory hierarchy, don't you?). Then, create a new container, or using the old one, navigate directly to the OCX from the container browser. You have to hit two different browse buttons to do this.

This should handle everything, even if you add new properties. I don't know for sure about methods. The project I worked on had ActiveX interface to an Access Database (we eventually replaced all of that *explative* code with real LabVIEW SQL code...much easier, better, more reliable, etc...) I had the programmer add some queries to the OCX, but I believe that these were only properties (data), but I can't be sure. My knowledge of ActiveX back then was a bit rusty.

Give those thigs a shot, and start programming in LabVIEW, instead of VB. You'll thank me later, I promise.
0 Kudos
Message 6 of 7
(4,523 Views)
Updating *.OCX OR *.DLL Component When Active X Automation Interface has Changed
----------------------------------------------

Given that you have changed the ActiveX automation interface, e.g: by appending new functions, then, the original 'registered' ActiveX server automation interface is no longer compatible with the new one.

In this case you must: (1) �un-register� the original interface; (2) Copy the New *.OCX/*.DLL File over the previous ones; (3) Then �re-register the new interface�; (4) After that you must visit ALL your LabVIEW Diagram �PROPERTY� and �METHOD� ActiveX automation nodes and re-reference those same functions.

These FOUR (4) Steps are further explained below:

1. Unregister the *.OCX or *.DLL file by running the command
-----------------------------------------------------
Regsvr32 /u �

Make sure that points to the full path name for your *.OCX or *.dll file. You must use the opening and closing quotes if your file path has spaces.



2. Copy the new *.OCX or *.DLL files over the old ones
------------------------------------------------------
This means that you will be over-writing the old *.OCX or *.DLL with the new files. Replacing these files is re-commended so that you do not end up with multiple copies of the same file.


3. Register The New *.OCX Controls
----------------------------------
Register the new controls by running the command

Regsvr32 �

This will now honor your new ActiveX automation interface in place of the last one.


4. Re-Visit All �PROPERTY� and �METHOD� Nodes and Re-Reference the same functions that appear in those nodes
---------------------------------------------

This means that you will be right-clicking on all the existing PROPERTY and METHOD nodes and choosing the functions accordingly from the drop-down list-view/menu. If the list view is grayed-out, then Steps 1 to 3 did not take!


NB: GOTCHA FOR *.DDL Users
-----------------------------
If you have sub-VIs that use the *.dll Ref icon then you will have to cut and re-insert this reference control in all those sub-Vis. A quick way is to copy the top level *.Dll ref icon and paste it over the control and indicator versions of the same in those sub VIs.

These four Steps plus the 'Gotcha Step' have worked consistenly when I have had to update ActiveX controls featuring a changed automation interface.
Message 7 of 7
(4,523 Views)