Problem with 32-bit COM component from 64-bit application. (TYPE_E_CANTLOADLIBRARY)

0

I have a created a dummy application for testing purposes which is a 64-bit console application, which creates an instance of a 32-bit COM application. It is a third party application called Laserforms.

static void Main(string[] args)
{
    LFM32.Application application;

    try
    {
        application = new LFM32.Application();
        Console.WriteLine("Success!");
        application.Quit();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.ToString());
    }
    finally
    {
        Console.Read();
    }
}

Now, this works perfectly on my machine, but when I deploy it to another machine, which has Laserform installed as well I am getting the below error message.

{System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'LFM32.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{6688DD46-3DA3-4FEC-8A1F-54E1453DCC77}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).}

I have go one through the registry of both and can't see any differences, what else could I be doing wrong?

UPDATE:

So I ran TlbImp on the .tlb file to create a DLL I could reference in my .NET application. This created a couple of extra DLLs and some warnings around Iunknown and some invalid types. I then ran Regasm (from Framework and Framework64) on this and the other DLLs it created but I am still seeing the exact same error.

com
com-interop
asked on Stack Overflow Aug 18, 2020 by Ryan Thomas • edited Aug 20, 2020 by Ryan Thomas

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0