指定したクラス ID (CLSID) に関連付けられている型を取得します。
Overloads Public Shared Function GetTypeFromCLSID( _
ByVal clsid As Guid _) As Type
[C#]
public static Type GetTypeFromCLSID(Guidclsid);
[C++]
public: static Type* GetTypeFromCLSID(Guidclsid);
[JScript]
public static function GetTypeFromCLSID(
clsid : Guid) : Type;
パラメータ
- clsid
取得する型の CLSID。
戻り値
CLSID が有効かどうかに関係なく System.__ComObject 。
使用例
[Visual Basic, C#, C++] 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
[C#]
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());
}
}
[C++]
#using <mscorlib.dll>
using namespace System;
int main() {
// Create a GUID object by passing the clsid parameter.
Guid myGuid1 = Guid(S"1AE77DA4-1063-4ab3-BCD2-085B001EFB97");
// Get the type object associated with the CLSID.
Type* myType1 = Type::GetTypeFromCLSID(myGuid1);
// Display the GUID.
Console::WriteLine(__box(myType1->GUID));
// Convert the GUID to a String*.
Console::WriteLine(myType1);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
Type クラス | Type メンバ | System 名前空間 | Type.GetTypeFromCLSID オーバーロードの一覧