0
votes

I am updating a program at work that uses a .ocx file to communicate with a database. The program works just fine with a version of the .ocx that was compiled a few months ago. However, if I try to compile a new version of the .ocx file, the program doesn't want to communicate with the database anymore.

My first thought was that something must be wrong in the code of the .ocx file. So I tried opening a backup of the .ocx project (which contains the same code as the working .ocx file) and compiled that. But that doesn't work either. Same code as the working .ocx, goes through the same registry processes during install, and yet it doesn't work.

I tried compiling more backups, all the way back to 2005, but none of the .ocx files work except the one I have that was compiled a few months ago.

Every time I recompile the .ocx file, I also register it with my program in the development environment and recompile the main program .exe file as well. The weird thing is, all the .ocx files that I compile from backups work when I run the program in my development environment. But as soon as I compile the main .exe file, move the files into the installer on another computer and install them, the program stops working properly.

So to summarize, I have a bunch of .ocx projects that will compile and work with my program in the development environment on the same computer. As soon as I move the files into the installer and install, the program stops working. I can get it to work with a .ocx file that I found from a few months ago, but when I try to compile the same project that produced that working file, the program doesn't work.

I tried pulling a .ocx file from a backup few years old without re-compiling (similar to what I did with the working copy), and that failed too. I can only get my installer to work with that one .ocx file from a few months ago. It can't be a problem with the code, since I tried compiling the original project of the working .ocx which has identical code. I don't think it's a registry issue, since all the files go through the same registry process during install.

At least I have a working installer (using the .ocx that I found) but now I'll never be able to make changes to the .ocx file, because everything I compile fails to work. I must be missing something, but I don't know what.

1
Please include the exact error you are getting. The error "doesn't work" is very hard to diagnose. Exact errors could jog someone's memory. I am willing to take a WAG at your problem. Are the version's of the ocx different. Projects that use ocx's include a version number in the reference. To view the version number open a properties window and go to the details tab.jac
Try: 1) Open the new OCX project 2) click Project -> Properties -> Component Tab 3) select Binary Compatibility 4) browse to a the working OCX in the file select box below 5) recompile the OCXAlex K.
Use a VM to setup clean build environment (tm) and use binary compatibility on your projects too. Take clean snapshot of the initial VM -- your registry is by now probably full of junk over past versions' compilations. You can't clean up these with regsvr32 /u unless you keep every OCX ever compiled on your dev machine, ever.wqw
@user2437443 In reply to your deleted questions; see msdn.microsoft.com/en-us/library/aa733715(v=vs.60).aspxAlex K.

1 Answers

0
votes

Thanks for the quick responses! Alex K.'s solution worked perfectly.

To fix my problem, I opened up one of the new ocx projects, went to Project->Properties->Component tab, selected the binary compatibility option and browsed to the location of the working ocx file.

This now allows me to make updates to my ocx project that work with my application.