ComRegisterFunctionAttribute クラスとは? わかりやすく解説

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

ComRegisterFunctionAttribute クラス

アセンブリCOM から使用できるように登録するときに呼び出すメソッド指定します。これにより、登録処理中にユーザー記述コード実行できるようになります

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
<AttributeUsageAttribute(AttributeTargets.Method, Inherited:=False)> _
Public NotInheritable Class
 ComRegisterFunctionAttribute
    Inherits Attribute
Dim instance As ComRegisterFunctionAttribute
[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)]
 
public sealed class ComRegisterFunctionAttribute
 : Attribute
[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets::Method, Inherited=false)]
 
public ref class ComRegisterFunctionAttribute
 sealed : public Attribute
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)
 */ 
public final class ComRegisterFunctionAttribute
 extends Attribute
ComVisibleAttribute(true) 
AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)
 
public final class ComRegisterFunctionAttribute
 extends Attribute
解説解説

この属性は、メソッド適用できます

ComRegisterFunctionAttribute使用すると、COM クライアント要件対応するための任意の登録コード追加できます。たとえば、Microsoft.Win32 名前空間の登録関数使用してレジストリ更新できます。登録メソッド提供する場合は、その登録メソッド実行され操作元に戻すための登録解除メソッドにも System.Runtime.InteropServices.ComUnregisterFunctionAttribute を適用する必要があります

格納しているアセンブリアセンブリ登録ツール (Regasm.exe) や RegistrationServices.RegisterAssembly API メソッド使用して (直接的または間接的に) 登録される場合共通言語ランタイムはこの属性を持つメソッド呼び出します。この属性を持つメソッド参照可能範囲 (パブリックプライベートなど) は任意ですが、このメソッドstatic である必要があり、登録する型を表す Type パラメータ1 つ受け取る必要があります

使用例使用例

適切なシグネチャを持つメソッドComRegisterFunctionAttributeComUnregisterFunctionAttribute適用する方法次の例に示します

Imports System
Imports System.Runtime.InteropServices

Public Class MyClassThatNeedsToRegister
    
    <ComRegisterFunctionAttribute()> Public Shared
 Sub _
      RegisterFunction(t As Type)
        'Insert code here.
    End Sub
    
    <ComUnregisterFunctionAttribute()> Public Shared
 Sub _
      UnregisterFunction(t As Type)
        'Insert code here.
    End Sub
End Class
using System;
using System.Runtime.InteropServices;

public class MyClassThatNeedsToRegister
{
   [ComRegisterFunctionAttribute]
   public static void RegisterFunction(Type
 t)
   {
      //Insert code here.
   }
   
   [ComUnregisterFunctionAttribute]
   public static void UnregisterFunction(Type
 t)
   {
      //Insert code here.
   }
}
using namespace System;
using namespace System::Runtime::InteropServices;
public ref class MyClassThatNeedsToRegister
{
public:

   [ComRegisterFunctionAttribute]
   static void RegisterFunction( Type^ t )
   {
      
      //Insert code here.
   }


   [ComUnregisterFunctionAttribute]
   static void UnregisterFunction( Type^ t
 )
   {
      
      //Insert code here.
   }

};

import System.*;
import System.Runtime.InteropServices.*;

public class MyClassThatNeedsToRegister
{
    /** @attribute ComRegisterFunctionAttribute()
     */
    public static void RegisterFunction(Type
 t)
    {
        //Insert code here.
    } //RegisterFunction

    /** @attribute ComUnregisterFunctionAttribute()
     */
    public static void UnregisterFunction(Type
 t)
    {
        //Insert code here.
    } //UnregisterFunction
} //MyClassThatNeedsToRegister
import System;
import System.Runtime.InteropServices;

public class MyClassThatNeedsToRegister
{
   ComRegisterFunctionAttribute public static
 function RegisterFunction(t : Type) : void
 
   {
      //Insert code here.
   }
   
   ComUnregisterFunctionAttribute public static
 function UnregisterFunction(t : Type) : void
   {
      //Insert code here.
   }
}
継承階層継承階層
System.Object
   System.Attribute
    System.Runtime.InteropServices.ComRegisterFunctionAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ComRegisterFunctionAttribute メンバ
System.Runtime.InteropServices 名前空間
ComUnregisterFunctionAttribute
RegisterAssembly
その他の技術情報
アセンブリ登録ツール (Regasm.exe)



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

辞書ショートカット

すべての辞書の索引

「ComRegisterFunctionAttribute クラス」の関連用語

ComRegisterFunctionAttribute クラスのお隣キーワード
検索ランキング

   

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



ComRegisterFunctionAttribute クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS