Unexpected Exception when calling COM object methods from Delphi?

1

I have a Delphi 6 professional program that is calling COM object methods belonging to an MSVC 2008 COM DLL. The DLL's Type Library imported without error into Delphi. I can call one of the method's without error, but most of the others lead to an EOleException error with the message "An unexpected exception was raised", which corresponds to the EOleException error code: 0x80040205, EVENT_E_INTERNALEXCEPTION:

http://msdn.microsoft.com/en-us/library/cc704587(v=prot.10).aspx

I am calling CoInitialize before making the call:

var
    intfMsvcComObj: IMsvcComObject;

begin
    if not Succeeded(CoInitialize(nil)) then
        raise Exception.Create('Coinitialize failed.');

    intfMsvcComObj := CoMsvcComObject.Create;

    try
        // EOleException occurs when I make this call.
        intfMsvcComObj.doSomething;
    finally
        CoUninitialize;
    end;
end;

Next I tried turning of FPU exceptions because that sometimes is an issue when calling into MSVC DLLS using Set8087CW($133f) and then I tried again with Set8087CW(Get8087CW or $3f), but neither of those operations helped.

Any ideas on how to fix/diagnose this?

delphi
visual-c++
exception
dll
com

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0