Modernize Studio
Language: English
Get a free proposal

Visual Basic 6

VB6 on Windows 11: OCX not registered error

The program always started, but on the new computer it stops because of an OCX file. Almost always, a component that Windows does not include is missing.

By Modernize StudioUpdated 5 min read

In short

  • Microsoft still supports the VB6 runtime on Windows 11, but many OCX files are not part of Windows.
  • Common components such as MSCOMCTL.OCX or COMDLG32.OCX must be installed together with the program: on a new computer they may be missing.
  • The safest route is to reinstall the program with its original installer.
  • Never download OCX files from DLL download sites: for Microsoft's own there is the official package.
  • Some OCX files are no longer supported, and those from other vendors depend on whoever created them.

The message

The program opens, but freezes on a particular form. Or it stops straight away, at startup. The message, which appears in English whatever the language of Windows, is usually this:

Run-time error '339': Component 'MSCOMCTL.OCX' or one of its dependencies not correctly registered: a file is missing or invalid

Instead of MSCOMCTL.OCX another name may appear: COMDLG32.OCX, MSFLXGRD.OCX, TABCTL32.OCX, RICHTX32.OCX. It means that the program uses a control, for example a grid, a calendar or a window for opening files, that is not on this computer or is not registered in Windows.

Note down the exact name of the file: you will need it for all the following steps.

Why it happens on Windows 11

Microsoft divides the Visual Basic 6 files into three groups:

  • files included in Windows, such as the core engine of VB6 programs: they are already there, Windows 11 included;
  • files to distribute with the program: among them MSCOMCTL.OCX, COMDLG32.OCX, MSFLXGRD.OCX, MSCOMCT2.OCX, TABCTL32.OCX, RICHTX32.OCX and MSMASK32.OCX. Microsoft supports them, but Windows does not include them: the program has to install them;
  • unsupported files, such as THREED32.OCX or GRID32.OCX, left over from even older versions.

That is why the error almost always appears after a change: a new computer, Windows reinstalled, or a program folder copied from another computer instead of installing the program. On the old computer the component was there, because the original setup had installed it.

The VB6 engine is in Windows; many of its controls are not.

What to do, in order

  1. Reinstall the program

    Use the program's original installer, started with an administrator account: it copies the OCX files to the right folder and registers them in Windows. It is the safest solution, because it installs exactly the versions the program was tested with.

  2. If the installer is gone

    For the OCX files on Microsoft's list, such as MSCOMCTL.OCX or COMDLG32.OCX, Microsoft provides the supported version for download: the link is in the support statement, among the sources at the bottom of the page.

  3. Have the component registered

    Registration is done with Regsvr32, the Windows tool that records the component in the system registry. It requires an administrator account: if you do not have one, ask whoever manages the computers.

  4. The right folder on 64-bit Windows

    VB6 OCX files are 32-bit. Microsoft explains that on 64-bit Windows the System32 folder is reserved for 64-bit programs, while 32-bit files are kept in SysWOW64: that is where the component belongs, before registering it.

Do not download OCX files from sites offering free DLL files: you do not know who has modified them or which version they are. Use only the program's installer, Microsoft's package or the files from the control's vendor.

To find out in advance which OCX files a program uses, and which ones Microsoft supports, you can use our free VB6 project check: it reads the project files in the browser, without sending them to anyone.

Would you like an opinion on your case?

Send us the file: within 48 hours you receive a free written assessment, even if the answer is that a small fix is enough.

How our prices work

The OCX files Microsoft does not support

  • Unsupported OCX files: among them THREED32.OCX, SPIN32.OCX, GAUGE32.OCX, GRAPH32.OCX, GRID32.OCX, ANIBTN32.OCX and KEYSTA32.OCX. Microsoft does not support them on Windows: if they stop working, there is no official fix.
  • OCX files with a replacement: for the old MSCHART.OCX, Microsoft points to an updated, supported version, MSCHRT20.OCX. Using it, however, requires changes to the program.
  • OCX files from other vendors: Microsoft cannot offer support and refers you to whoever created the control. If the vendor no longer exists, you depend on the files you have kept.

These are the cases where a VB6 program becomes truly fragile: a new computer without the right files is all it takes for part of the program to stop working.

How to avoid getting stuck

  • keep the program's installer and a copy of the OCX files it uses in a safe place, and not only on the server;
  • keep a list of the components, with the vendor's name for those not made by Microsoft;
  • test every new computer and every major Windows update on a test computer before using it for work;
  • remember that the runtime is 32-bit: on 64-bit Windows it runs in emulation, and Microsoft supports it only for serious regressions and critical security issues.

If the program matters to the business, it is worth deciding calmly what to do with it. We discuss this on the page about VB6 on Windows 11, and here we explain how we bring VB6 programs to the web.

Frequently asked questions

Can the OCX be copied from another computer?

Copying the file is not enough: it must also be registered in Windows. And it is best to take it from the program's original installation or from Microsoft's official package, not from just any computer.

Is the VB6 runtime still supported on Windows 11?

Yes. Microsoft supports it for the whole lifetime of Windows 11, but only for serious regressions and critical security issues. The development environment has not been supported since 8 April 2008.

Why does it work on one computer and not on another?

On the computer where it works, the component was installed and registered by the program's setup, perhaps years ago. On the new computer that step never happened.

Is the source code needed to fix the error?

No: to reinstall and register a component, the installer is enough. The code is needed, on the other hand, to replace an unsupported OCX or to move the program to a new technology.

Is there a 64-bit version of VB6 programs?

No. The Visual Basic 6 runtime is 32-bit only: on 64-bit Windows the programs run in the emulation environment provided by Microsoft.

Sources

  1. Microsoft: support statement for Visual Basic 6.0 on Windows
  2. Microsoft: file system redirector on 64-bit Windows
  3. Microsoft: the Regsvr32 tool
  4. Microsoft Q&A: error with an OCX not correctly registered

Official Microsoft pages.

Related guides

Related services

All guides

Contact

We work in writing: everything stays on record, so you can show it to your accountant or your IT person.

Send us your file

  1. Make a copy of the file; test data is fine.
  2. Attach it to your message. If you would like a non-disclosure agreement first, write to us without attaching the file.
  3. Within 48 hours you will receive the free written assessment and the price of a pilot module.

We work from Italy.

Describe your project in a few lines

A small request is fine too. If anything is missing, we will ask you.

Fields marked * are required.

For example: what the program is used for · database used (Access, SQL Server, other) · do you have the program's code? · number of users

Attachment(optional)

Databases, Excel files, screenshots or a specification. For larger files, include a download link in your message. We only work on copies and delete them at the end of the project, with written confirmation.

Reply within one working day. Free proposal, no obligation.

Get a free proposal