Marshal.GetComInterfaceForObjectInContext(Object, Type) Método

Definição

Devolve um ponteiro de interface que representa a interface especificada para um objeto, se o chamador estiver no mesmo contexto que esse objeto.

public:
 static IntPtr GetComInterfaceForObjectInContext(System::Object ^ o, Type ^ t);
public static IntPtr GetComInterfaceForObjectInContext(object o, Type t);
[System.Security.SecurityCritical]
public static IntPtr GetComInterfaceForObjectInContext(object o, Type t);
static member GetComInterfaceForObjectInContext : obj * Type -> nativeint
[<System.Security.SecurityCritical>]
static member GetComInterfaceForObjectInContext : obj * Type -> nativeint
Public Shared Function GetComInterfaceForObjectInContext (o As Object, t As Type) As IntPtr

Parâmetros

o
Object

O objeto que fornece a interface.

t
Type

O tipo de interface que é pedido.

Devoluções

IntPtr

nativeint

O ponteiro de interface especificado por t isso representa a interface para o objeto especificado, ou null se o chamador não estiver no mesmo contexto que o objeto.

Atributos

Exceções

t não é uma interface.

-ou-

O tipo não é visível para o COM.

o não suporta a interface solicitada.

o é null.

-ou-

t é null.

Observações

Este método é o mesmo, GetComInterfaceForObject exceto que retorna null se o chamador não estiver no mesmo contexto que o objeto. É particularmente útil se tiveres um método não gerido que espera receber um ponteiro de interface.

Aplica-se a

Ver também