Marshal.GetComInterfaceForObjectInContext(Object, Type) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Parameters
- o
- Object
The object that provides the interface.
- t
- Type
The type of interface that is requested.
Returns
nativeint
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.
- Attributes
Exceptions
o
does not support the requested interface.
Remarks
This method is the same as GetComInterfaceForObject except that it returns null
if the caller is not in the same context as the object. It is particularly useful if you have an unmanaged method that expects to be passed an interface pointer.
Applies to
See also
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應