RealProxy.SetCOMIUnknown(IntPtr) 메서드

정의

현재 인스턴스가 나타내는 개체의 관리되지 않는 프록시를 저장합니다.

public:
 virtual void SetCOMIUnknown(IntPtr i);
public virtual void SetCOMIUnknown(IntPtr i);
abstract member SetCOMIUnknown : nativeint -> unit
override this.SetCOMIUnknown : nativeint -> unit
Public Overridable Sub SetCOMIUnknown (i As IntPtr)

매개 변수

i
IntPtr

nativeint

현재 프록시 인스턴스가 IUnknown 나타내는 개체의 인터페이스에 대한 포인터입니다.

예제

[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

설명

관리되지 않는 프록시가 COM을 통해 공용 언어 런타임과 통신하려고 하면 런타임은 관리되지 않는 프록시로 표시되는 원격 개체를 확인합니다. 원격 개체가 관리되고 공용 언어 환경에 있는 경우 분산 COM을 통해 통신하는 대신 개체가 현재 프로세스로 전송됩니다.

원격 개체가 파생되지 MarshalByRefObject않은 경우 직렬화되어 현재 위치에 복사됩니다. 파생된 MarshalByRefObject경우 투명 프록시를 반환하고 원격 인프라는 나중에 사용하기 위해 투명 프록시에 관리되지 않는 프록시( IUnknown 인터페이스)를 캐시합니다.

적용 대상