Type.GetTypeFromProgID メソッド (String, Boolean)
型の読み込み中にエラーが発生した場合に例外をスローするかどうかを指定して、指定したプログラム ID (ProgID) に関連付けられた型を取得します。
名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文
Public Shared Function GetTypeFromProgID ( _ progID As String, _ throwOnError As Boolean _ ) As Type
Dim progID As String Dim throwOnError As Boolean Dim returnValue As Type returnValue = Type.GetTypeFromProgID(progID, throwOnError)
- progID
取得する型の ProgID。
戻り値
progID がレジストリの有効なエントリで、型がそれに関連付けられている場合は、指定したプログラム ID (ProgID) に関連付けられている型。それ以外の場合は null 参照 (Visual Basic では Nothing)。


このメソッドは COM サポートに対して提供されます。プログラム ID の代わりに名前空間の概念が導入されたため、プログラム ID は Microsoft .NET Framework では使用されません。

ProgID が無効な場合に例外をスローするかどうかを指定して、ProgID を渡して型を取得する例を次に示します。この例では次に、ProgID に関連付けられている ClassID、および該当する例外メッセージを表示します。
Imports System Class MainApp Public Shared Sub Main() Try ' Use the ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. Dim myString1 As String = "DIRECT.ddPalette.3" ' Use a nonexistent ProgID WrongProgID. Dim myString2 As String = "WrongProgID" ' Make a call to the method to get the type information of the given ProgID. Dim myType1 As Type = Type.GetTypeFromProgID(myString1, True) Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType1.GUID.ToString()) ' Throw an exception because the ProgID is invalid and the throwOnError ' parameter is set to True. Dim myType2 As Type = Type.GetTypeFromProgID(myString2, True) Catch e As Exception Console.WriteLine("An exception occurred.") Console.WriteLine("Source: {0}", e.Source.ToString()) Console.WriteLine("Message: {0}", e.Message.ToString()) End Try End Sub 'Main End Class 'MainApp
using System; class MainApp { public static void Main() { try { // Use the ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. string myString1 ="DIRECT.ddPalette.3"; // Use a nonexistent ProgID WrongProgID. string myString2 ="WrongProgID"; // Make a call to the method to get the type information of the given ProgID. Type myType1 =Type.GetTypeFromProgID(myString1,true); Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType1.GUID); // Throw an exception because the ProgID is invalid and the throwOnError // parameter is set to True. Type myType2 =Type.GetTypeFromProgID(myString2,true); } catch(Exception e) { Console.WriteLine("An exception occurred."); Console.WriteLine("Source: {0}", e.Source); Console.WriteLine("Message: {0}", e.Message); } } }
using namespace System; int main() { try { // Use the ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. String^ myString1 = "DIRECT.ddPalette.3"; // Use a nonexistent ProgID WrongProgID. String^ myString2 = "WrongProgID"; // Make a call to the method to get the type information of the given ProgID. Type^ myType1 = Type::GetTypeFromProgID( myString1, true ); Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID ); // Throw an exception because the ProgID is invalid and the throwOnError // parameter is set to True. Type^ myType2 = Type::GetTypeFromProgID( myString2, true ); } catch ( Exception^ e ) { Console::WriteLine( "An exception occurred." ); Console::WriteLine( "Source: {0}", e->Source ); Console::WriteLine( "Message: {0}", e->Message ); } }


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Type.GetTypeFromProgID メソッド (String, String, Boolean)
型の読み込み中にエラーが発生した場合に例外をスローするかどうかを指定して、指定したサーバーの指定したプログラム ID (ProgID) に関連付けられた型を取得します。
名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文
Public Shared Function GetTypeFromProgID ( _ progID As String, _ server As String, _ throwOnError As Boolean _ ) As Type
Dim progID As String Dim server As String Dim throwOnError As Boolean Dim returnValue As Type returnValue = Type.GetTypeFromProgID(progID, server, throwOnError)
public static function GetTypeFromProgID ( progID : String, server : String, throwOnError : boolean ) : Type
戻り値
progID がレジストリの有効なエントリで、型がそれに関連付けられている場合は、指定したプログラム ID (progID) に関連付けられている Type。それ以外の場合は null 参照 (Visual Basic では Nothing)。


このメソッドは COM サポートに対して提供されます。プログラム ID の代わりに名前空間の概念が導入されたため、プログラム ID は Microsoft .NET Framework では使用されません。

ProgID とサーバー名を渡して型を取得する例を次に示します。この例では次に、ProgID かサーバー名が無効な場合に例外をスローするかどうかを指定して、ProgID に関連付けられている ClassID を表示します。
Imports System Class MainApp Public Shared Sub Main() Try ' Use Server localhost. Dim theServer As String = "localhost" ' Use ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. Dim myString1 As String = "DirControl.DirList.1" ' Use a wrong ProgID WrongProgID. Dim myString2 As String = "WrongProgID" ' Make a call to the method to get the type information for the given ProgID. Dim myType1 As Type = Type.GetTypeFromProgID(myString1, theServer, True) Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType1.GUID.ToString()) ' Throw an exception because the ProgID is invalid and the throwOnError ' parameter is set to True. Dim myType2 As Type = Type.GetTypeFromProgID(myString2, theServer, True) Catch e As Exception Console.WriteLine("An exception occurred. The ProgID is wrong.") Console.WriteLine("Source: {0}", e.Source.ToString()) Console.WriteLine("Message: {0}", e.Message.ToString()) End Try End Sub 'Main End Class 'MainApp
using System; class MainApp { public static void Main() { try { // Use server localhost. string theServer="localhost"; // Use ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. string myString1 ="DirControl.DirList.1"; // Use a wrong ProgID WrongProgID. string myString2 ="WrongProgID"; // Make a call to the method to get the type information for the given ProgID. Type myType1 =Type.GetTypeFromProgID(myString1,theServer,true); Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType1.GUID); // Throw an exception because the ProgID is invalid and the throwOnError // parameter is set to True. Type myType2 =Type.GetTypeFromProgID(myString2, theServer, true); } catch(Exception e) { Console.WriteLine("An exception occurred. The ProgID is wrong."); Console.WriteLine("Source: {0}" , e.Source); Console.WriteLine("Message: {0}" , e.Message); } } }
using namespace System; int main() { try { // Use server localhost. String^ theServer = "localhost"; // Use ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. String^ myString1 = "DirControl.DirList.1"; // Use a wrong ProgID WrongProgID. String^ myString2 = "WrongProgID"; // Make a call to the method to get the type information for the given ProgID. Type^ myType1 = Type::GetTypeFromProgID( myString1, theServer, true ); Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID ); // Throw an exception because the ProgID is invalid and the throwOnError // parameter is set to True. Type^ myType2 = Type::GetTypeFromProgID( myString2, theServer, true ); } catch ( Exception^ e ) { Console::WriteLine( "An exception occurred. The ProgID is wrong." ); Console::WriteLine( "Source: {0}", e->Source ); Console::WriteLine( "Message: {0}", e->Message ); } }


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Type.GetTypeFromProgID メソッド (String, String)
指定したサーバーから、指定したプログラム ID (progID) に関連付けられている型を取得し、型の読み込み中にエラーが発生した場合は null を返します。
名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文
Dim progID As String Dim server As String Dim returnValue As Type returnValue = Type.GetTypeFromProgID(progID, server)
- progID
取得する型の ProgID。
戻り値
progID がレジストリの有効なエントリで、型がそれに関連付けられている場合は、指定したプログラム ID (ProgID) に関連付けられている型。それ以外の場合は null 参照 (Visual Basic では Nothing)。


このメソッドは COM サポートに対して提供されます。プログラム ID の代わりに名前空間の概念が導入されたため、プログラム ID は Microsoft .NET Framework では使用されません。

ProgID とサーバー名を渡して型を取得する例を次に示します。この例では次に、ProgID に関連付けられている ClassID を表示するか、ProgID かサーバー名が無効な場合に例外をスローします。
Imports System Class MainApp Public Shared Sub Main() Try ' Use ProgID localhost\HKEY_CLASSES_ROOT\DirControl.DirList.1. Dim theProgramID As String = "DirControl.DirList.1" ' Use Server name localhost. Dim theServer As String = "localhost" ' Make a call to the method to get the type information for the given ProgID. Dim myType As Type = Type.GetTypeFromProgID(theProgramID, theServer) If myType Is Nothing Then Throw New Exception("Invalid ProgID or server.") End If Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType.GUID.ToString()) Catch e As Exception Console.WriteLine("An exception occurred.") Console.WriteLine("Source: {0}.", e.Source.ToString()) Console.WriteLine("Message: {0}.", e.Message.ToString()) End Try End Sub 'Main End Class 'MainApp
using System; class MainApp { public static void Main() { try { // Use the ProgID localhost\HKEY_CLASSES_ROOT\DirControl.DirList.1. string theProgramID ="DirControl.DirList.1"; // Use the server name localhost. string theServer="localhost"; // Make a call to the method to get the type information for the given ProgID. Type myType =Type.GetTypeFromProgID(theProgramID,theServer); if(myType==null) { throw new Exception("Invalid ProgID or Server."); } Console.WriteLine("GUID for ProgID DirControl.DirList.1 is {0}.", myType.GUID); } catch(Exception e) { Console.WriteLine("An exception occurred."); Console.WriteLine("Source: {0}" , e.Source); Console.WriteLine("Message: {0}" , e.Message); } } }
using namespace System; int main() { try { // Use the ProgID localhost\HKEY_CLASSES_ROOT\DirControl::DirList.1. String^ theProgramID = "DirControl.DirList.1"; // Use the server name localhost. String^ theServer = "localhost"; // Make a call to the method to get the type information for the given ProgID. Type^ myType = Type::GetTypeFromProgID( theProgramID, theServer ); if ( myType == nullptr ) { throw gcnew Exception( "Invalid ProgID or Server." ); } Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType->GUID ); } catch ( Exception^ e ) { Console::WriteLine( "An exception occurred." ); Console::WriteLine( "Source: {0}", e->Source ); Console::WriteLine( "Message: {0}", e->Message ); } }


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Type.GetTypeFromProgID メソッド (String)
指定したプログラム ID (ProgID) に関連付けられている型を取得し、Type の読み込み中にエラーが発生した場合は null を返します。
名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文
Dim progID As String Dim returnValue As Type returnValue = Type.GetTypeFromProgID(progID)
- progID
取得する型の ProgID。
戻り値
progID がレジストリの有効なエントリで、型がそれに関連付けられている場合は、指定したクラス ProgID に関連付けられている型。それ以外の場合は null 参照 (Visual Basic では Nothing)。




Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Type.GetTypeFromProgID メソッド
指定したプログラム ID (ProgID) に関連付けられている型を取得します。
オーバーロードの一覧
名前 | 説明 |
---|---|
Type.GetTypeFromProgID (String) | 指定したプログラム ID (ProgID) に関連付けられている型を取得し、Type の読み込み中にエラーが発生した場合は null を返します。 |
Type.GetTypeFromProgID (String, Boolean) | 型の読み込み中にエラーが発生した場合に例外をスローするかどうかを指定して、指定したプログラム ID (ProgID) に関連付けられた型を取得します。 |
Type.GetTypeFromProgID (String, String) | 指定したサーバーから、指定したプログラム ID (progID) に関連付けられている型を取得し、型の読み込み中にエラーが発生した場合は null を返します。 |
Type.GetTypeFromProgID (String, String, Boolean) | 型の読み込み中にエラーが発生した場合に例外をスローするかどうかを指定して、指定したサーバーの指定したプログラム ID (ProgID) に関連付けられた型を取得します。 |

Weblioに収録されているすべての辞書からType.GetTypeFromProgIDを検索する場合は、下記のリンクをクリックしてください。

- Type.GetTypeFromProgIDのページへのリンク