Type.GetTypeFromCLSID Method (Guid, String)
.NET Framework 1.1
Gets the type associated with the specified class identifier (CLSID) from the specified server.
[Visual Basic] Overloads Public Shared Function GetTypeFromCLSID( _ ByVal clsid As Guid, _ ByVal server As String _ ) As Type [C#] public static Type GetTypeFromCLSID( Guid clsid, string server ); [C++] public: static Type* GetTypeFromCLSID( Guid clsid, String* server ); [JScript] public static function GetTypeFromCLSID( clsid : Guid, server : String ) : Type;
Parameters
- clsid
- The CLSID of the type to get.
- server
- The server from which to load the type. If the server name is a null reference (Nothing in Visual Basic), this method automatically reverts to the local machine.
Return Value
System.__ComObject regardless of whether the CLSID is valid.
Example
[Visual Basic, C#, C++] The following example retrieves the type associated with the CLSID from the local host.
[Visual Basic] ' 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()) [C#] // 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()); [C++] // Create a GUID. Guid myGuid2 = Guid(S"00020812-0000-0000-c000-000000000046"); // Get the type associated with the CLSID // from the local host. Type* myType2 =Type::GetTypeFromCLSID(myGuid2, S"."); Console::WriteLine(S"The GUID associated with myType2 is {0}.",__box( myType2->GUID)); Console::WriteLine(S"The type of the GUID is {0}.", myType2);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
Type Class | Type Members | System Namespace | Type.GetTypeFromCLSID Overload List