问题
I have old VB6 Addin (Visio) source code that generates DLL when compile. I need to distribute this dll to end user, but when I run following command as Administrator on user's PC:
regsvr32 MyAddin.dll
it throws:
The Module "MyAddin.dll" was loaded but the call to DllRegisterServer failed with error code 0x80004005.
To debug this I created a new VB6 Addin project, changed Application to "Microsoft Visio" in Connect.Dsr. and tried to installed this dll to fresh windows 10 VM having Visio. Still got the same error.
Since this dll works on my PC, and only significant difference between my PC and VM/user's PC is VB6 Enterprise IDE, so I installed "Visual Basic 6 Enterprise" on the VM, after which I was able to register dll there as well. Obviously I can't ask end user to install Visual Basic 6 Enterprise, how can I know the dependencies for "Addin" project template? or which are the bare minimum files from VB 6 Enterprise should I bundle in my setup?
Here's the screenshot of dependency of generated dll, nothing fancy here
回答1:
The Windows error “0x80004005” occurs particularly in situations in which users are denied access to an application, a service or a device for unforeseeable reasons.
Process Monitor from https://docs.microsoft.com/en-us/sysinternals/downloads/procmon might be of some help. Run it as admin, create an appropriate filter and see if somethig useful pops up.
回答2:
Turns out VB6 office addins depends on Add-In Designer Object Library (msaddndr.dll) and this library is not available post Office 2013
I registered MSADDNDR.dll and it fixed the problem.
For more details https://blogs.msdn.microsoft.com/vsod/2012/11/21/vb6-based-add-ins-may-fail-to-work-in-office-2013/
来源:https://stackoverflow.com/questions/59463345/distributing-visio-addin-developed-in-vb6