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.


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.