WebBrowser.DetachSink メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebBrowser.DetachSink メソッドの意味・解説 

WebBrowser.DetachSink メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

基になる ActiveX コントロールの CreateSink メソッドアタッチされたイベント処理クライアント解放します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

解説解説
使用例使用例

WebBrowser から派生したクラスでこのメソッド使用し標準WebBrowser イベントOLE DWebBrowserEvents2 の NavigateError イベント補完する方法次のコード例示します

コード全体については、「CreateSink」を参照してください

Private cookie As AxHost.ConnectionPointCookie
Private helper As WebBrowser2EventHelper

<PermissionSetAttribute(SecurityAction.LinkDemand, _
Name := "FullTrust")> Protected
 Overrides Sub CreateSink()

    MyBase.CreateSink()

    ' Create an instance of the client that will handle the event
    ' and associate it with the underlying ActiveX control.
    helper = New WebBrowser2EventHelper(Me)
    cookie = New AxHost.ConnectionPointCookie( _
        Me.ActiveXInstance, helper, GetType(DWebBrowserEvents2))
End Sub

<PermissionSetAttribute(SecurityAction.LinkDemand, _
Name := "FullTrust")> Protected Overrides Sub
 DetachSink()

    ' Disconnect the client that handles the event
    ' from the underlying ActiveX control.
    If cookie IsNot Nothing Then
        cookie.Disconnect()
        cookie = Nothing
    End If
    MyBase.DetachSink()

End Sub
AxHost.ConnectionPointCookie cookie;
WebBrowser2EventHelper helper;

[PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")]
protected override void CreateSink()
{
    base.CreateSink();

    // Create an instance of the client that will handle the event
    // and associate it with the underlying ActiveX control.
    helper = new WebBrowser2EventHelper(this);
    cookie = new AxHost.ConnectionPointCookie(
        this.ActiveXInstance, helper, typeof(DWebBrowserEvents2));
}

[PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")]
protected override void DetachSink()
{
    // Disconnect the client that handles the event
    // from the underlying ActiveX control.
    if (cookie != null)
    {
        cookie.Disconnect();
        cookie = null;
    }
    base.DetachSink();
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

WebBrowser.DetachSink メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebBrowser.DetachSink メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS