COM Interop: One interface fails query interface while another works.
- From: Jan Obrestad <obrestad@xxxxxxxxxxxxxx>
- Date: Mon, 04 Jun 2007 10:16:21 +0200
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?
.
- Follow-Ups:
- Prev by Date: Re: COM-InterOp Error Message: RPC_E_SERVER_DIED
- Next by Date: Attach to all running Excel processes
- Previous by thread: RE: Problems with FindNextPrinterChangeNotification in C#
- Next by thread: Re: COM Interop: One interface fails query interface while another works.
- Index(es):
Relevant Pages
|