COM Interop: One interface fails query interface while another works.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



While developing a .NET module that uses COM to communicate with the main application, I have seen this strange error.
I have a class that I expose to COM (BookAndPlanFormSupport) this class implements two interfaces that are also exposed to COM (IDotNetSupportBase and IDotNetMdiSupport).

The resulting IDL looks like this.

coclass BookAndPlanFormSupport {
interface _Object;
interface IDotNetSupportBase;
[default] interface IDotNetMdiSupport;
};

The problem is that in the c++ code query interface on one of the interfaces works, on the other it doesn't.

Example code:
#import "WrapperInterfaces.tlb" no_namespace raw_interfaces_only named_guids

IDotNetMdiSupportPtr m_pForm;
IDotNetSupportBasePtr m_pFormBase;

HRESULT hr, hr2

hr =m_pForm.CreateInstance((LPCSTR)"<prefix>.BookAndPlanFormSupport");
hr2=m_pFormBase.CreateInstance((LPCSTR)"<prefix>.BookAndPlanFormSupport");

Here the m_pForm.CreateInstance succeeds, but m_pFormBase.CreateInstance fails with the error: "The system could not find the file specified".

To make things stranger, this is only a problem when I try to install the program, when I run it on my development machine everything works fine.

Has anybody experienced anything like this?
.



Relevant Pages

  • Opinion Wanted - How to Expose a Collection
    ... expose collections in your interface. ... You're still exposing it in your interface. ... Implement a custom collection - Expose the collection, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Encapsulation vs separation of concerns
    ... >> class interface does not count. ... public int boomCounter; ... > that only exposes exactly what it wants to expose and no more. ...
    (comp.object)
  • Re: Need help using VS 2008 Unit Test framework.
    ... it's is you that does not understand how to do a unit test or a functional test. ... line the framework will expose the inherited public member. ... The control should be on an Interface, tested via the Interface with mocking of the Directory object and mocking the method via an Interface to pass the test, which can be archived within the current test harness that's being used. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: In desperate need of COM interop help
    ... to expose a managed .exe to an unmanaged .exe through COM. ... You will also have to manually alter some registry entries to ... and an interface that contains the methods I want to expose to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Encapsulation vs separation of concerns
    ... >> implements an interface is fully encapsulated because the interface is ... > class CIAmNotExposingSomething: IFoo ... > public void Boom() ... that only exposes exactly what it wants to expose and no more. ...
    (comp.object)