C # shell interface error: E_NOINTERFACE

I am trying to create a C # wrapper for a COM object that I have (named SC_COM.dll), but I have some problems associated with it with Visual Studio 2008 (running Vista). I need to do this without registering with the COM DLL - I use the manifest file so that Visual Studio knows about SC_COM.dll and it seems to work. I used TblImp.exe to create the type library (SC_COMtlb.dll) that I reference in Visual Studio 2008, so I can make an early binding to the DLL that I need. DLL files are in the same directory as the manifest and the executable.

Here's the problem: when I instantiate an object and try to call one of its methods in C #, it throws the following error:

An error was detected: it was not possible to pass a COM object of type "SC_COMtlb.SCAccessObjClass" to the interface type "SC_COMtlb.ISCUploader". This operation failed because the call to QueryInterface on the COM component for the interface with IID '{C677308A-AC0F-427D-889A-47E5DC990138} failed due to the following error: this interface is not supported (exception from HRESULT: 0x80004002 (E_NOINTERFACE) )

I'm not quite sure what this error means. I searched by error code, and this is apparently a relatively common C # error. So am I going to associate the COM object with the wrong way here, or is there some other important step that I can skip?

, , , , (S\C_COMtlb.dll) , COM-, - , . , , ?

+3
3

App.exe.manifest:

<comInterfaceExternalProxyStub 
  name="ISCUploader" 
  iid="{C677308A-AC0F-427D-889A-47E5DC990138}"
  proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
  baseInterface="{00000000-0000-0000-C000-000000000046}"
  tlbid = "{PUT-YOUR-TLB-GUID-HERE}" />

TLBID Visual Studio, Native.Namespace.Assembly.Name.manifest, :

<typelib tlbid="{A-GUID-IS-HERE--USE-IT}"
  version="1.0" helpdir="" resourceid="0" flags="HASDISKIMAGE" />

, , :

+6

, Visual Studio , , "" , , .

, SC_COM.dll. TLBIMP.EXE , DLL, .

, SC_COM ++, , DLL, IDL, , .

, DLL: , ISomething2, ISomething, , ISomething2. , . .

( ) DLL?

+1

Windows? Windows Vista, . # , , whatever.exe.manifest .

# EXE, " " "". "" , .

, MT.EXE, .EXE.

0

Source: https://habr.com/ru/post/1709531/


All Articles