RealProxy.GetCOMIUnknown(Boolean) 메서드

정의

현재 프록시 인스턴스가 나타내는 개체에 대한 관리되지 않는 참조를 요청합니다.

public:
 virtual IntPtr GetCOMIUnknown(bool fIsMarshalled);
public virtual IntPtr GetCOMIUnknown(bool fIsMarshalled);
[System.Security.SecurityCritical]
public virtual IntPtr GetCOMIUnknown(bool fIsMarshalled);
abstract member GetCOMIUnknown : bool -> nativeint
override this.GetCOMIUnknown : bool -> nativeint
[<System.Security.SecurityCritical>]
abstract member GetCOMIUnknown : bool -> nativeint
override this.GetCOMIUnknown : bool -> nativeint
Public Overridable Function GetCOMIUnknown (fIsMarshalled As Boolean) As IntPtr

매개 변수

fIsMarshalled
Boolean

true 원격 위치로 마샬링하기 위해 개체 참조가 요청되면 이고, false COM을 통해 현재 프로세스에서 관리되지 않는 개체와의 통신을 위해 개체 참조가 요청된 경우

반품

IntPtr

nativeint

COM을 통해 현재 프로세스에서 관리되지 않는 개체와의 통신을 위해 개체 참조가 요청된 경우 COM 호출 가능 래퍼 에 대한 포인터이거나, 개체 참조가 원격 위치로 마샬링하도록 요청된 경우 캐시되거나 새로 생성된 IUnknown COM 인터페이스에 대한 포인터입니다.

특성

예제

[SecurityPermission(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::Infrastructure)]
IntPtr SupportsInterface( Guid * /*myGuid*/ )
{
   Console::WriteLine( "SupportsInterface method called" );
   
   // Object reference is requested for communication with unmanaged objects
   // in the current process through COM.
   IntPtr myIntPtr = this->GetCOMIUnknown( false );
   
   // Stores an unmanaged proxy of the object.
   this->SetCOMIUnknown( myIntPtr );
   
   // return COM Runtime Wrapper pointer.
   return myIntPtr;
}
public override IntPtr SupportsInterface(ref Guid myGuid)
{
    Console.WriteLine("SupportsInterface method called");
    // Object reference is requested for communication with unmanaged objects
    // in the current process through COM.
    IntPtr myIntPtr = this.GetCOMIUnknown(false);
    // Stores an unmanaged proxy of the object.
    this.SetCOMIUnknown(myIntPtr);
    // return COM Runtime Wrapper pointer.
    return myIntPtr;
}
<SecurityPermission(SecurityAction.LinkDemand, Flags := SecurityPermissionFlag.Infrastructure)> _
Public Overrides Function SupportsInterface(ByRef myGuid As Guid) As IntPtr
   Console.WriteLine("SupportsInterface method called")
   ' Object reference is requested for communication with unmanaged objects
   ' in the current process through COM.
   Dim myIntPtr As IntPtr = Me.GetCOMIUnknown(False)
   ' Stores an unmanaged proxy of the object.
   Me.SetCOMIUnknown(myIntPtr)
   ' return COM Runtime Wrapper pointer.
   Return myIntPtr
End Function 'SupportsInterface

설명

프록시가 마샬링을 IUnknown 요청하면 현재 프록시 인스턴스가 나타내는 개체에 대한 인터페이스가 반환됩니다. 이전에 메서드에 IUnknown 의해 SetCOMIUnknown 캐시된 경우 해당 인스턴스가 반환되고, 그렇지 않으면 새 인스턴스가 반환됩니다.

프록시가 마샬링이 아니라 현재 프로세스에서 관리되지 않는 개체와의 통신을 위해 요청되면 COM을 통한 통신에 현재 프로세스에서 사용할 수 있는 COM 호출 가능 래퍼 (CCW)가 반환됩니다.

적용 대상