Jan Obrestad
6/4/2007 8:16:00 AM
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?