# Solved: VB6 &amp; comdlg32.ocx



## DataBase (Jan 15, 2004)

Hi all,

Years ago when at University i wrote a program using VB6 for a friend for her non profit making company. She recently had new hardware installed as well as reinstalling WindowsXP on all machines. When she installs the sofware and runs it she gets an error saying

"Component 'Comdlg32.ocx' is not registered, a file is missing or invalid"

now i have recreated this problem on my test machine and found that by simply placing the ocx file and the system32 folder and registering it using run the problem is solved.

My question is using visual studio 9 (2008) and creating a setup project how can i get the setup file to:

1) place the ocx (which i downloaded) in the system32 folder?

2) get it to register?

Notes:
Guys im aware that VB6 is way out of date now, and that i could convert the vb6 program into newer code using the convertor, but this is not what she wants, she is used to the old program and is adament that i just fix the installer and NOT upgrade the software.

If someone can please help me i would appreciate that a lot.

Thanks,


----------



## pvc_ (Feb 18, 2008)

if you are gonna be using VB.Net, you can import the System.IO namespace and then use file.copy(par 1, par2) to copy the ocx to system32. And then you can use system.diagnostics.process.start("regsvr32.exe", par1) to register the ocx file. Par1 would be the same string you type in run to register the dll manually.


----------



## DataBase (Jan 15, 2004)

Hey pvc thanks for your help, but i was able to use another source to getting my problem solved.

for those who are interested heres what i done.

1) I created a system folder by selecting "Create Special Folder" (Right click on folder dir)

2) I imported into this the OCX files i wanted to place in the system32 folder and register, i also created some VBScript that called the regsvr32.exe in the system32 folder and sent it the ocx file to register.heres how

CreateObject("WScript.Shell").Run """%windir%\system32\regsvr32"" /s ""%windir%\system32\Comdlg32.ocx""", 7

This can be done in notepad and saved with the extention .vbs

once i placed them in there i had to go to

3) View >> Editor >> Customer Actions - right click on the 'Commit' folder and select the two vbs files i just placed in the special folder.

When i ran the installer after this it placed the ocx files in the system32 folder and registered them.


----------

