Marshal.GetComInterfaceForObjectInContext(Object, Type) Método
Definição
Retorna um ponteiro de interface que representa a interface especificada para um objeto, se o chamador estiver no mesmo contexto que o objeto.Returns an interface pointer that represents the specified interface for an object, if the caller is in the same context as that object.
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.The object that provides the interface.
- t
- Type
O tipo de interface solicitado.The type of interface that is requested.
Retornos
O ponteiro de interface especificado por t que representa a interface para o objeto especificado ou null, se o chamador não estiver no mesmo contexto de objeto.The interface pointer specified by t that represents the interface for the specified object, or null if the caller is not in the same context as the object.
- Atributos
Exceções
t não é uma interface.t is not an interface.
- ou --or- O tipo não é visível para COM.The type is not visible to COM.
o não dá suporte à interface solicitada.o does not support the requested interface.
Comentários
Esse método é igual a GetComInterfaceForObject , exceto que ele retorna null se o chamador não está no mesmo contexto que o objeto.This method is the same as GetComInterfaceForObject except that it returns null if the caller is not in the same context as the object. Isso é particularmente útil se você tiver um método não gerenciado que espera ser passado para um ponteiro de interface.It is particularly useful if you have an unmanaged method that expects to be passed an interface pointer.