.netexceptioncomocx

.NET COMException Interface non registered


I can't understand this. I want to use an OCX from this vendor http://www.mobyt.it/ to send SMSs. It is a dll and they provide usage examples in Vb, .NET, Visual C, etc.

The exception I get is:

System.Runtime.InteropServices.COMException (0x80040154): Interface not registered. (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

I'm breaking my mind. It looks like the COM object is not registered, but how should I register it? I've tried with regsvr32 with lo luck.


Solution

  • Assuming it registered properly, a standard failure mode is running on a 64-bit version of Windows. COM servers like this are almost always only usable from 32-bit code. Right-click your EXE project > Properties > Build tab > Platform target = x86. Tick the "Prefer 32-bit" checkbox if available and enabled. Repeat for the Release configuration.

    The next approach is to use Regedit.exe and verify that it was actually registered. Navigate to HKLM\Software\Wow6432Node\Classes\CLSID\{guid} where {guid} is the GUID that you got from the error message. On a 32-bit operating system, you'd find it in HKLM\Software\etc.

    The next approach is to use SysInterals' ProcMon utility to observe your program searching the registry and trying to load the DLL.

    The next approach is to call the supplier for support.

    And then you give up trying to make it work.