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

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

Type.GetTypeFromCLSID メソッド (Guid, String)

指定したサーバーから、指定したクラス ID (CLSID) に関連付けられている型を取得します

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

Public Shared Function GetTypeFromCLSID
 ( _
    clsid As Guid, _
    server As String _
) As Type
Dim clsid As Guid
Dim server As String
Dim returnValue As Type

returnValue = Type.GetTypeFromCLSID(clsid, server)
public static Type GetTypeFromCLSID (
    Guid clsid,
    string server
)
public:
static Type^ GetTypeFromCLSID (
    Guid clsid, 
    String^ server
)
public static Type GetTypeFromCLSID (
    Guid clsid, 
    String server
)
public static function GetTypeFromCLSID
 (
    clsid : Guid, 
    server : String
) : Type

パラメータ

clsid

取得する型の CLSID。

server

型の読み込み元のサーバーサーバー名が null 参照 (Visual Basic では Nothing) の場合、このメソッド自動的にローカル マシンの名前を使用します

戻り値
CLSID が有効かどうかに関係なく System.__ComObject

使用例使用例

ローカル ホストの CLSID に対応する型を取得する例を次に示します

' Create a GUID.
Dim myGuid2 As New Guid("00020812-0000-0000-c000-000000000046")
' Get the type associated with the CLSID
' from the local host.
Dim myType2 As Type = Type.GetTypeFromCLSID(myGuid2,
 ".")
Console.WriteLine("The GUID associated with myType2 is {0}.",
 myType2.GUID.ToString())
Console.WriteLine("The type of the GUID is {0}.",
 myType2.ToString())
// Create a GUID.
Guid myGuid2 = new Guid("00020812-0000-0000-c000-000000000046");
// Get the type associated with the CLSID
// from the local host.
Type myType2 =Type.GetTypeFromCLSID(myGuid2, ".");
Console.WriteLine("The GUID associated with myType2 is {0}.", myType2.GUID);
Console.WriteLine("The type of the GUID is {0}.", myType2.ToString());
// Create a GUID.
Guid myGuid2 = Guid("00020812-0000-0000-c000-000000000046");
// Get the type associated with the CLSID
// from the local host.
Type^ myType2 = Type::GetTypeFromCLSID( myGuid2, "." );
Console::WriteLine( "The GUID associated with myType2 is {0}.", myType2->GUID
 );
Console::WriteLine( "The type of the GUID is {0}.", myType2 );
// Create a GUID.
Guid myGuid2 = new Guid("00020812-0000-0000-c000-000000000046");

// Get the type associated with the CLSID
// from the local host.
Type myType2 = Type.GetTypeFromCLSID(myGuid2, ".");
Console.WriteLine("The GUID associated with myType2 is {0}.",
    myType2.get_GUID());
Console.WriteLine("The type of the GUID is {0}.",
    myType2.ToString());
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Type.GetTypeFromCLSID メソッド (Guid, Boolean)

型の読み込み中にエラーが発生した場合例外スローするかどうか指定して指定したクラス ID (CLSID) に関連付けられた型を取得します

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

Public Shared Function GetTypeFromCLSID
 ( _
    clsid As Guid, _
    throwOnError As Boolean _
) As Type
Dim clsid As Guid
Dim throwOnError As Boolean
Dim returnValue As Type

returnValue = Type.GetTypeFromCLSID(clsid, throwOnError)
public static Type GetTypeFromCLSID (
    Guid clsid,
    bool throwOnError
)
public:
static Type^ GetTypeFromCLSID (
    Guid clsid, 
    bool throwOnError
)
public static Type GetTypeFromCLSID (
    Guid clsid, 
    boolean throwOnError
)
public static function GetTypeFromCLSID
 (
    clsid : Guid, 
    throwOnError : boolean
) : Type

パラメータ

clsid

取得する型の CLSID。

throwOnError

発生した例外をすべてスローする場合true

または

発生した例外をすべて無視する場合false

戻り値
CLSID が有効かどうかに関係なく System.__ComObject

解説解説

throwOnErrortrue指定すると OutOfMemoryException などの例外スローされますが、CLSID が未登録でも失敗することはありません。

使用例使用例

型の読み込み中にエラーが発生した場合例外スローするかどうか指定してローカル ホストの CLSID に対応する型を取得する例を次に示します

Imports System
Class MyGetTypeFromCLSIDSample
    Public Shared Sub Main()
        Try
            ' Create a GUID.
            Dim myGuid1 As New
 Guid("1DCD0710-0B41-11D3-A565-00C04F8EF6E3")
            ' Get the type associated with the CLSID
            ' and specify whether to throw an exception if an error
 occurs
            ' while loading the type.
            Dim myType1 As Type = Type.GetTypeFromCLSID(myGuid1,
 True)
            Console.WriteLine("The GUID associated with myType1
 is {0}.", myType1.GUID.ToString())
            Console.WriteLine("The type of the GUID is {0}.",
 myType1.ToString())
using System;
class MyGetTypeFromCLSIDSample
{
    public static void Main()
    {
        try
        {
            // Create a GUID.
            Guid myGuid1 = new Guid("1DCD0710-0B41-11D3-A565-00C04F8EF6E3");
            // Get the type associated with the CLSID
            // and specify whether to throw an exception if an error
 occurs
            // while loading the type.
            Type myType1 =Type.GetTypeFromCLSID(myGuid1, true);
            Console.WriteLine("The GUID associated with myType1 is {0}."
,
 myType1.GUID);
            Console.WriteLine("The type of the GUID is {0}.", myType1.ToString());
using namespace System;

int main()
{
   try
   {
      // Create a GUID.
      Guid myGuid1 = Guid("1DCD0710-0B41-11D3-A565-00C04F8EF6E3");
      // Get the type associated with the CLSID
      // and specify whether to throw an exception if an error occurs
      // while loading the type.
      Type^ myType1 = Type::GetTypeFromCLSID( myGuid1, true );
      Console::WriteLine( "The GUID associated with myType1 is {0}.", myType1->GUID
 );
      Console::WriteLine( "The type of the GUID is {0}.", myType1 );
import System.*;

class MyGetTypeFromCLSIDSample
{
    public static void main(String[]
 args)
    {
        try {
            // Create a GUID.
            Guid myGuid1 = new Guid("1DCD0710-0B41-11D3-A565-00C04F8EF6E3");

            // Get the type associated with the CLSID
            // and specify whether to throw an exception if an error
 occurs
            // while loading the type.
            Type myType1 = Type.GetTypeFromCLSID(myGuid1, true);
            Console.WriteLine("The GUID associated with myType1 is {0}."
,
                myType1.get_GUID());
            Console.WriteLine("The type of the GUID is {0}.",
                myType1.ToString());
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Type.GetTypeFromCLSID メソッド (Guid)

指定したクラス ID (CLSID) に関連付けられている型を取得します

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

Public Shared Function GetTypeFromCLSID
 ( _
    clsid As Guid _
) As Type
Dim clsid As Guid
Dim returnValue As Type

returnValue = Type.GetTypeFromCLSID(clsid)
public static Type GetTypeFromCLSID (
    Guid clsid
)
public:
static Type^ GetTypeFromCLSID (
    Guid clsid
)
public static Type GetTypeFromCLSID (
    Guid clsid
)
public static function GetTypeFromCLSID
 (
    clsid : Guid
) : Type

パラメータ

clsid

取得する型の CLSID。

戻り値
CLSID が有効かどうかに関係なく System.__ComObject

使用例使用例

Guid 構造体コンストラクタclsid パラメータ渡して GUID取得してから、指定したクラス ID (CLSID) に対応する型を取得する例を次に示します

Imports System
Class MyGetTypeFromCLSID
    Public Shared Sub Main()
        ' Create  a GUID object by passing the clsid parameter.
        Dim myGuid1 As New
 Guid("1AE77DA4-1063-4ab3-BCD2-085B001EFB97")
        ' Get the type associated with the CLSID.
        Dim myType1 As Type = Type.GetTypeFromCLSID(myGuid1)
        ' Display the GUID.
        Console.WriteLine(myType1.GUID.ToString())
        ' Convert the GUID to a string.
        Console.WriteLine(myType1.ToString())
    End Sub 'Main 
End Class 'MyGetTypeFromCLSID
using System;
class MyGetTypeFromCLSID
{
    public static void Main()
    {
        // Create a GUID object by passing the clsid parameter.
        Guid myGuid1 = new Guid("1AE77DA4-1063-4ab3-BCD2-085B001EFB97");
        // Get the type object associated with the CLSID.
        Type myType1 = Type.GetTypeFromCLSID(myGuid1);
        // Display the GUID.
        Console.WriteLine(myType1.GUID);
        // Convert the GUID to a string.
        Console.WriteLine(myType1.ToString());                        
    }
}
using namespace System;
int main()
{
   
   // Create a GUID object by passing the clsid parameter.
   Guid myGuid1 = Guid("1AE77DA4-1063-4ab3-BCD2-085B001EFB97");
   
   // Get the type object associated with the CLSID.
   Type^ myType1 = Type::GetTypeFromCLSID( myGuid1 );
   
   // Display the GUID.
   Console::WriteLine( myType1->GUID );
   
   // Convert the GUID to a String*.
   Console::WriteLine( myType1 );
}

import System.*;

class MyGetTypeFromCLSID
{
    public static void main(String[]
 args)
    {
        // Create a GUID object by passing the clsid parameter.
        Guid myGuid1 = new Guid("1AE77DA4-1063-4ab3-BCD2-085B001EFB97");

        // Get the type object associated with the CLSID.
        Type myType1 = Type.GetTypeFromCLSID(myGuid1);

        // Display the GUID.
        Console.WriteLine(myType1.get_GUID());

        // Convert the GUID to a string.
        Console.WriteLine(myType1.ToString());
    } //main
} //MyGetTypeFromCLSID
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Type.GetTypeFromCLSID メソッド


Type.GetTypeFromCLSID メソッド (Guid, String, Boolean)

型の読み込み中にエラーが発生した場合例外スローするかどうか指定して指定したサーバー指定したクラス ID (CLSID) に関連付けられた型を取得します

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

Public Shared Function GetTypeFromCLSID
 ( _
    clsid As Guid, _
    server As String, _
    throwOnError As Boolean _
) As Type
Dim clsid As Guid
Dim server As String
Dim throwOnError As Boolean
Dim returnValue As Type

returnValue = Type.GetTypeFromCLSID(clsid, server, throwOnError)
public static Type GetTypeFromCLSID (
    Guid clsid,
    string server,
    bool throwOnError
)
public:
static Type^ GetTypeFromCLSID (
    Guid clsid, 
    String^ server, 
    bool throwOnError
)
public static Type GetTypeFromCLSID (
    Guid clsid, 
    String server, 
    boolean throwOnError
)
public static function GetTypeFromCLSID
 (
    clsid : Guid, 
    server : String, 
    throwOnError : boolean
) : Type

パラメータ

clsid

取得する型の CLSID。

server

型の読み込み元のサーバーサーバー名が null 参照 (Visual Basic では Nothing) の場合、このメソッド自動的にローカル マシンの名前を使用します

throwOnError

発生した例外をすべてスローする場合true

または

発生した例外をすべて無視する場合false

戻り値
CLSID が有効かどうかに関係なく System.__ComObject

解説解説

throwOnErrortrue指定すると OutOfMemoryException などの例外スローされますが、CLSID が未登録でも失敗することはありません。

使用例使用例

型の読み込み中にエラーが発生した場合例外スローするかどうか指定してローカル ホストの CLSID に対応する型を取得する例を次に示します

' Create a GUID.
Dim myGuid3 As New Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B")
' Get the type associated with the CLSID
' from the local host and specify whether to throw an exception if an
 
' error occurs while loading the type.
Dim myType3 As Type = Type.GetTypeFromCLSID(myGuid3,
 ".", True)
Console.WriteLine("The GUID associated with myType3 is {0}.",
 myType3.GUID.ToString())
Console.WriteLine("The type of the GUID is {0}.",
 myType3.ToString())
// Create a GUID.
Guid myGuid3 = new Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B");
// Get the type associated with the CLSID
// from the local host and specify whether to throw an exception if
 an 
// error occurs while loading the type.
Type myType3 =Type.GetTypeFromCLSID(myGuid3, ".", true);
Console.WriteLine("The GUID associated with myType3 is {0}.", myType3.GUID);
Console.WriteLine("The type of the GUID is {0}.", myType3.ToString()); 
// Create a GUID.
Guid myGuid3 = Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B");
// Get the type associated with the CLSID
// from the local host and specify whether to throw an exception if
 an
// error occurs while loading the type.
Type^ myType3 = Type::GetTypeFromCLSID( myGuid3, ".", true
 );
Console::WriteLine( "The GUID associated with myType3 is {0}.", myType3->GUID
 );
Console::WriteLine( "The type of the GUID is {0}.", myType3 );
// Create a GUID.
Guid myGuid3 = new Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B");

// Get the type associated with the CLSID
// from the local host and specify whether to throw an exception 
// if an error occurs while loading the type.
Type myType3 = Type.GetTypeFromCLSID(myGuid3, ".", true);
Console.WriteLine("The GUID associated with myType3 is {0}.",
    myType3.get_GUID());
Console.WriteLine("The type of the GUID is {0}.",
    myType3.ToString());
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS