Reputation: 6845
I wrote an assembly in C# and I needed to invoke a method on the DLL from a VB6.0 application.
I made the DLL COM compliant and registered the DLL accordingly. From my VB application I would then instantiate the class in the .NET assembly using the VB6.0 CreateObject
method.
Set dotNetObj = CreateObject("Namespace.ClassName")
I would then be able to invoke any method on that class.
The Problem:
All worked fine, until I tried executing the code on a Vista machine. Whenever I execute the exe it works fine, but whenever the exe is executed using the 'run as administrator' option the following error appears:
"ActiveX component can`t create object."
I need this EXE to run in admin mode, else certain areas of the legacy system won't work.
Any ideas on why the CreateObject
would not work in admin mode?
Upvotes: 1
Views: 420
Reputation: 4028
Because it is only registered in the user space?
Try to register your dll in an admin shell
regasm mycomponent.dll /register /codebase /tlb
Upvotes: 0
Reputation: 1062780
It sounds like maybe the COM component is only registered for the user - so when the admin tries it, the clsid is unknown. Try running your isntallation/registration process for the admin.
(does vista put clsids in HKCU? or just HKLM?)
A quick search seems to indicate that it relates to whether UAC is enabled or disabled... with it enabled it looks in HKCU... disabled and it looks in HKLM. So if you are installing into HKCU, it won't be there for an admin with UAC disabled.
Upvotes: 1