הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Tuesday, October 22, 2013 3:19 PM
Hello,
I am developing an Visual Basic application that running on Windows 7 and using COM. This has been working before and suddenly stopped working. The Visual Basic application is running with elevated privileges. Here is the line that is throwing an exception:
DIM IESProgram AsNewIES.Document
The exception looks like this:
************* Exception Text **************
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {7CC726EC-CAED-4C0F-AD5B-4EC5A862E32A} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at ReadRegistry.Form1.BtnStartIES_Click(Object sender, EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18052 built by: FX45RTMGDR
CodeBase:
ReadRegistry
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 11.0.50709.17929 built by: FX45RTMREL
CodeBase:
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18044 built by: FX45RTMGDR
CodeBase:
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase:
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18047 built by: FX45RTMGDR
CodeBase:
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18021 built by: FX45RTMGDR
CodeBase:
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18060 built by: FX45RTMGDR
CodeBase:
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18060 built by: FX45RTMGDR
CodeBase:
System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase:
This does not happen when I run the application without elevated privileges. In this case it really needs to work elevated.
Any help will be appreciated...
Thanks,
Thomas
All replies (3)
Tuesday, October 29, 2013 11:42 AM ✅Answered | 2 votes
This could also be an issue of building the code using a
64 bit
configuration. You can try to selectx86
as the build platform which can solve this issue. To do this right-click the solution and selectConfiguration Manager
From there you can change thePlatform
of the project using the 32-bit .dll tox86
Check this link:
http://stackoverflow.com/questions/3003719/hresult-0x80040154-regdb-e-classnotreg
Test that if you rebuild it to x86, will it works for you.
And we could also check the rights as the following link(I think it may be similar to C#):
http://stackoverflow.com/questions/15618576/instantiating-a-com-component-fails-with-class-not-registered-when-run-as-adm
Hope it helps.
Nice day. : )
remember make the reply as answer and vote the reply as helpful if it helps.
Tuesday, October 22, 2013 10:37 PM
Well, the error message is pretty clear: the COM object you are trying to use is not registered in the system. Perhaps you accidentally uninstalled it, or something.
Igor Tandetnik
Wednesday, October 23, 2013 12:46 PM
This is not the case. The Visual Basic application installs the self registering MFC application first, then starts it once to get it self registered. I can then check the registry and confirm that registering the MFC application worked. Now it depends if the Visual Basic application is running with elevated privileges or not. DIM IESProgram As New IES.Document above exception is thrown if it is running elevated. The same is working if it is not elevated.
The Visual Basic application purpose is to do quality testing with the MFC application. Since it is doing installing and uninstalling the MFC application it does need to run with elevated privileges.
Thanks,
Thomas