Component comdlg32.ocx or one of its dependencies not correctly registered: a file is missing or invalid

I am getting this error when I tried to run my application on my friends pc . I copied this file COMDLG32.OCX’ from my laptop and tried to paste on that pc in System32 folder. but getting below error

This folder already contains a file named ‘COMDLG32.OCX’, WOULD YOU LIKE TO REPLACE THIS.

What would be the impact if replace the new file with existing file which is of higher version and more kb. Is there any other way to deal with this? This is also a case with other files like flexgrid, tabb control.

thanks

Dani AI

Generated

Short answer: do not blindly replace a system/shared OCX with a copy from another machine. Overwriting a newer or signed OCX can break other apps. Back up the existing file first (rename to *.old or move it to a safe folder), then follow a proper registration and deployment procedure. This expands on 's suggestion to re-register and on 's installer advice.

Check OS bitness and register with the correct regsvr32 (run an elevated command prompt). On 64‑bit Windows, 32‑bit OCXs belong in C:\Windows\SysWOW64 and must be registered with the regsvr32 in that folder; on 32‑bit Windows use System32. Example commands:

:: Run from an elevated (Administrator) command prompt

:: 32-bit Windows
regsvr32 "C:\Windows\System32\COMDLG32.OCX"

:: 64-bit Windows - register a 32-bit OCX
C:\Windows\SysWOW64\regsvr32.exe "C:\Windows\SysWOW64\COMDLG32.OCX"

:: 64-bit Windows - register a 64-bit OCX
C:\Windows\System32\regsvr32.exe "C:\Windows\System32\COMDLG32.OCX"

Better distribution workflow: build an installer that includes and registers required OCXs rather than manual copy-paste. Use an installer that can include merge modules or mark files as shared or private so other applications are not broken. The Package & Deployment Wizard is an option historically noted by , but modern choices (Visual Studio setup projects, Inno Setup, NSIS, commercial installers) provide more control and safer redistributables. Include the official VB6 runtime/common-controls redistributables instead of ad hoc copying.

If registration fails, restore the backup and troubleshoot: run regsvr32 to see the error, check dependent DLLs with Dependency Walker (or a modern equivalent), ensure Admin rights, and compare file versions via Properties -> Details before changing anything. Following these steps avoids most version/compatibility problems when moving VB6 controls like comdlg32.ocx, FlexGrid, or tab controls between machines.

Recommended Answers

All 2 Replies

You need to check the ocx versions before replacing it, you could render your computer unusable if you replace an existing ocx with an older version.

Have you tried to re-register it? Here are some tutorials on how to do that.

You should use an installer program to install your program on another computer. Your development environment has met all the dependencies; otherwise, your program would not run.

Use the Package and Deployment wizard. This should pick up all the dependencies and install the appropriate files needed for your program and ressiter them to run on a different computer.

The Package and Deployment Wizard, however, is really out of date. But it can be used as a basis for Visual Studio Installer 1.1 to make a Microsoft Installer (MSI) file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.