2

I created a wrapper to a commercial closed-source program by using TLBIMP.EXE. (The program can't be referenced directly by Visual Studio although it can be referenced in VB6.) VS references the wrapper just fine, and is able to create an object. However, it crashes with the following error, as soon as I call a method on the object:

{"Unable to cast COM object of type 'InfoWorksLib.InfoWorksClass' to interface type 'InfoWorksLib.IIW'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{61305DAA-3868-41AD-956D-081010E80E8B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."}

My code looks like this:

void Function()
{
  InfoWorksLib.IIW iw = new InfoWorksLib.InfoWorksClass(); // Works
  iw.InitForTest(0, "", ""); // crashes with the above exception
}

I've tried all possible combinations of declaration and creation (e.g. InfoWorks iw = new InfoWorksClass(), etc.)

The object explorer in VS shows the following:

InfoWorksLib
    InfoWorksLib
        EIWErrors
        IIW (interface)
        InfoWorks (interface)
            Base Types (folder)
                IIW (interface)
        InfoWorksClass
            Base Types (folder)
                IIW
                InfoWorks
                    IIW
                Object

This is on Windows 7. On a Windows XP virtual machine the same code works fine.

Are there any security issues on Windows 7 that may be causing the above exception? Does the wrapper assembly need to be located in a non-system directory?

LucasMcGraw
  • 129
  • 3
  • 12
  • Contact the vendor for support. – Hans Passant Aug 15 '12 at 21:28
  • Unfortunately they don't provide any support, I've tried. – LucasMcGraw Aug 16 '12 at 13:45
  • @LucasMcGraw I'm curious, do you have documentation regarding the InfoWorks CS interface? The only one I have found is [this](http://www.kompetenz-wasser.de/wp-content/uploads/2017/05/20090824_sam-cso_applicability_openmi_api_final.pdf). Apparently there used to be a full API reference though... – Sancarn Jan 21 '18 at 15:34

0 Answers0