COM and interface

O

Ondrej

Hi everybody,

I am starting with C#. I have COM object, which sometimes exposes
IEnumTerminal interface and sometimes it doesn't, because exsistence of this
interface depends on the other factors.

My question is, how may I find out with IAddress interface (interface of my
COM object), whether my COM object exposes the IEnumTerminal interface?

I know, how to do it in other programming languages (using
IAddress->QueryInterface), but I have problem to do it in C#.

Thanks you a lot

Ondrej
 
W

Willy Denoyette [MVP]

Using a cast will QI under the covers:

IEnumTerminal enumTerm = IAddress as IEnumTerminal ;
if(enumTerm != null)
{
// OK QI succeeded
// do someting with it
}
else
// QI for IEnumTerminal failed

Willy.
PS. please post interop questions to the interop NG -
microsoft.public.dotnet.framework.interop.
 
O

Ondrej

Willy, thanks very much.

Ondrej



Willy Denoyette said:
Using a cast will QI under the covers:

IEnumTerminal enumTerm = IAddress as IEnumTerminal ;
if(enumTerm != null)
{
// OK QI succeeded
// do someting with it
}
else
// QI for IEnumTerminal failed

Willy.
PS. please post interop questions to the interop NG -
microsoft.public.dotnet.framework.interop.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top