views:

41

answers:

3

Is it important for a VB6 app to refer to certain OCX versions?

I have noticed that if I put my VB6 app code through the IDE on one machine then the form files will refer to different version of some OCXs than if I use another machine.

What is the rule of thumb with this? Is it safe to assume that most of these old OCX versions will be compatible with each other and so I shouldn't worry?

Some of the OCXs in question are:

RICHTX32.OCX  v1.1 and v1.2
COMCTL32.OCX  v1.2 and v1.3
A: 

It may matter if the changes in versions create "breaking" changes. If on your developer machines it doesn't seem to affect the application in an adverse way you are likely fine on those machines. However, if/when you need to deploy this code to one or more users machines you will also need to make sure these controls are on those machines along with a version that is compatible with your code.

You can create an install package that would wrap up and install the versions you are using to ensure this would not be an issue.

klabranche
Will the correct versions of the OCXs self-register when the app is executed on other machines?
Craig Johnston
Many of the OCXs/controls MAY already exist on another machine but in your case I don't know if the two you are interested in are. There is a VB6 runtime download you can apply on client machines but I'm not sure what all is in it. If they don't exist on the other machine, just executing the app on that machine will not work. You will have to get the controls over to that machine, either through the VB6 Runtime download (if it has these controls in them), by creating an installer that does this or doing it manually where you copy the files needed to the machine and register the controls.
klabranche
If an OCX with the same filename exists on a machine but it is actually a different version that what an app is expecting, will the app still work?
Craig Johnston
It depends. If the version differences do not have breaking changes between them or are compatible then it will. You will have to give it a shot to see what will happen. Just like you found that between your two developer machines the version difference didn't break your app it MAY be the same on another machine.
klabranche
+1  A: 

Is it important for a VB6 app to refer to certain OCX versions?

  • Yes, because you are "binding" your code to the interface of the ActiveX control.

What is the rule of thumb with this?

Is it safe to assume that most of these old OCX versions will be compatible with each other and so I shouldn't worry?

  • Do not worry. The two controls in question are Microsoft controls. One for the rich-text-box and the other is a wrapper to the Windows common controls. You should have no problems with these controls. (There were issues with the rich-text-control on older versions of Windows, but this has been resolved on Windows NT versions.)

For other ActiveX controls, usually from third-party vendors or in-house, you may have a problem. In your specific case, I would not worry about it, until it happens. This is a very complex subject.

AMissico
@Missico: doesn't "Upgrade Activex Controls" upgrade the controls in the project to the latest available on the machine? If so, why is that necessarily a good idea?
Craig Johnston
Updates to the latest controls on the development machine.
AMissico
Always create an installation. Always uninstall old versions before installing new versions. You cannot deploy VB6 applications that depend on other controls by simply distributing the executable.
AMissico
Updates to the latest controls on the development machine. This is the default behavior and works 99.9% of the time. The only time I ever had to change this setting was when I migrated a VB5 application to VB6 and I had to use the older control versions whose interface changed between versions. (This is a complex subject.)
AMissico
+2  A: 

You should probably install the ocx files your application was created with replacing existing versions only if the version you are installing is newer. Here is a question http://stackoverflow.com/questions/345111/how-can-you-force-vb6-to-use-the-dlls-and-ocxs-from-the-app-directory that explains installing all your application files into the same folder and running from there.

Beaner
+1 and you don't have to register them either. This means you might well be able to XCOPY deploy your app without needing an installation.
MarkJ