简体   繁体   中英

Add a VB6 ActiveX DLL reference to a VS2008 project

At work, we have a VB6 project (ActiveX DLL) that we need to be able to add as a reference to another VS2008 C# project.

A developer there tells me that in the past, they have been able to do so but now we made a change to the VB6 DLL and had to recompile it.

As such, we need to update the reference in the VS2008 project but when we try to add the reference to the VB6 DLL back (after removing the old reference) to the VS2008 project, we get a yellow "!" icon on the newly added reference and then when we build, VS2008 says the reference cannot be found.

I tried the "Browse" and "COM" tabs where you can add reference, no luck.

Do we need some kind of TLB to be able to add it or something ?

Thanks.

You need to do the following from a command prompt:

#CD to wherever the dll is located
regsrv32 /u foo.dll
regsrv32 foo.dll

This will unregister the old com object and register the new one.

He's right, you could do that from command prompt.

Remember though, your Active-X control DLL could be 16-bit, so use

    regsrv /u foo.dll
    regsrv foo.dll

from command prompt. But 32-bit works fine for regsrv32!

I used OLE/COM object viewer (included in Windows SDK 6.0A) then I saw a bunch of COM entries in "All objects" ie: MyDLLName.className and some were pointing to a DLL file which did not exist anymore. Deleted all the relevant COM entries in the Windows registry that pointed to the deleted DLL and left all the ones which pointed to the existing DLL and then I could import it successfully in my VC# project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM