3
votes

I'm working on an application developed for Windows XP SP3, using VB6. I'm currently in the process of getting it to work on Windows 7, but am encountering a problem with one of our custom OCX files.

When attempting to load a form that contains an instance of the control contained in the problem OCX, the following error is produced:

Failed to load control 'x' from y.ocx. Your version of y.ocx may be outdated. Make sure you are using the version of the control that was provided with your application.

I've checked the version numbers and they're all correct and referencing the proper version. The OCX registers fine, and all the expected registry entries are present.

Inspection with DependencyWalker shows no missing dependencies.

The software works fine under XP, and this is (seemingly) the only issue when running on Windows 7.

Interestingly, if I run through the VB6 IDE using a VB6 group (with the offending OCX part of the group, and the application the startup project), I don't have the issue. Running the application on it's own through the IDE still presents the error.

Any ideas on what could be missing which would cause the application to throw this error?

Error occurs on both Windows 7 Professional and Home Professional, both 32 bit.

3
Is VB6 even supported on Windows 7?John Saunders
@jacksmith - Maybe not officially supported but even the VB6 IDE runs on Windows 8Matt Wilko
It is a registration problem, run regsvr32.exe from an elevated command prompt. Use the c:\windows\syswow64 version on a 64-bit version of Windows.Hans Passant

3 Answers

4
votes

This is almost certainly an interface compatibility problem. COM interfaces are versioned entirely separately from your Major/Minor/Revision numbers, which are little more than comments except as used by Installer.

Somewhere along the line you broke binary compatibility, and you are trying to deploy a library with a newer interface than your application was compiled against.

These version numbers are found in keys such as:

HKEY_CLASSES_ROOT\CLSID\{class Id GUID}\VERSION

Your program needs to have its old reference to the OCX removed, a new one set, and then it must be recompiled. This also means deleting any instances of the control and adding them back one by one.

I doubt this is a Windows 7 issue.

0
votes

I would suspect this is a UAC problem. Try turning UAC off to see if that solves the immediate issue. If it does then you have to regsiter everything using 'run as administrator' and/or create a manifest for you application.

0
votes

Sounds like on of the controls included in your OCX is having issues loading, not a general registration error. Look at the constructors for x control, and see if they are doing anything that disagrees with UAC or such. One way you can debug this is put some kind of a break before the control is initialized, and debug the application from Visual Studio (remember to create the PDB's in VB6), and then carry on from the break to see why the control isn't initializing.