I have this annoying thing that happens with my .NET Interop Toolkit user controls and VB6 occasionally, this is described below:
1.I have two interop controls, so VB6 will make two OCA files for mscoree.dll, according to the following algorithm:
//- Try the directory of the OCX file, replacing extension with OCA.
//- Try the directory of VB6.EXE, using OCX file base name
//- Try the directory of VB6.EXE, using a random file name
//- Try windows directory, using OCX file base name
//- Try windows directory, using a random file name
//- Try TMP directory, using a random file name and extension.
2. What happens instead is that something goes wrong and VB6 now associates one OCA file with two different controls. This could happen because I manually deleted the OCX file registery entries and the OCA file (to reproduce: create a control, COM register it, insert it into VB6, delete the OCA, create a second control, COM register it, insert it into VB6 - you should get the old control).
3. This means if I insert both controls into the same project I can an error about duplicating the name of the type library: “Name conflicts with existing module, project, or object library”.
This is fixed by doing the following:
1. Deleting all the OCA files (yes, they are all over the show) and the hidden type library declarations in the registry.
2. Deleting all the registry keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Visual Basic\6.0\ which are GUIDs. This seems to be a list of object types associated with OCA files. And this is where I suspect the problem lies - VB6 thinks mscoree.dll is associated with an OCA file that actually belongs to another control.
Hope this helps anyone out there who runs into the same problem as me!