-
January 11th, 2010, 07:06 AM
#1
COM - Query an Interface inherited from IUnknown
Hey there,
I've got a bit a strange problem. Which means I think I already know the reason, but I do not see any way around it ^^.
But let me descripe. Basicly I've got an simple interface inherting from IUnknown:
Code:
[
object,
...
]
interface IMyInterface : IUnknown {
}
So far so good. Now I want to inherit many other interfaces from this interface so that a method can use different special methods of this interface later on dynamicly in the code:
Code:
[
object,
...
]
interface ISpecialInterface1 : IMyInterface {
}
[
object,
...
]
interface ISpecialInterface2 : IMyInterface {
}
// ...
Everything works fine, until I e.g. call QueryInterface of a special class to get an pointer to the base interface:
Code:
STDMETHODIMP ISpecialInterface2::GetInterface(/* [out, retval] */ IMyInterface** Interface)
{
this->QueryInterface(IID_IMyInterface, reinterpret_cast<void**>(Interface));
return S_OK;
}
Somehow I allways get an AccessViolation Exception or an InvalidCast Exeption. I guess it is because I do not implement IMyInterface so it stays abstract. But usually this is the idea behind an interface. I allways thought the methods are pointers to the real implementations of the methods, but... I don't know ^^.
Any solutions?
Thank you,
- Aschratt.
-
January 14th, 2010, 04:17 AM
#2
Re: COM - Query an Interface inherited from IUnknown
To help you, I think we'll need a bit more detail on what you are doing.
A question:
ISpecialInterface2 should only have pure virtual member functions, why is ISpecialInterface2::GetInterface being implemented?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|