Win32Exceptionとは? わかりやすく解説

Win32Exception クラス

Win32 エラー コード例外スローさます。

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

<SerializableAttribute> _
Public Class Win32Exception
    Inherits ExternalException
    Implements ISerializable
Dim instance As Win32Exception
[SerializableAttribute] 
public class Win32Exception : ExternalException,
 ISerializable
[SerializableAttribute] 
public ref class Win32Exception : public
 ExternalException, ISerializable
/** @attribute SerializableAttribute() */ 
public class Win32Exception extends ExternalException
 implements ISerializable
SerializableAttribute 
public class Win32Exception extends
 ExternalException implements ISerializable
解説解説
使用例使用例

Win32例外キャッチしその内容解釈する方法次のコード例示します。この例では、存在しない実行可能ファイル起動するため、Win32例外発生します例外キャッチしたときに、この例では、それぞれのエラー メッセージエラー コード、および例外発生源フェッチます。

Try
    Dim myProc As New System.Diagnostics.Process()
    myProc.StartInfo.FileName = "c:\nonexist.exe"
  'Attempting to start a non-existing executable
    myProc.Start()    'Start the application and assign it to the process
 component.    

Catch w As System.ComponentModel.Win32Exception
    Console.WriteLine(w.Message)
    Console.WriteLine(w.ErrorCode.ToString())
    Console.WriteLine(w.NativeErrorCode.ToString())
    Console.WriteLine(w.StackTrace)
    Console.WriteLine(w.Source)
    Dim e As New Exception()
    e = w.GetBaseException()
    Console.WriteLine(e.Message)
End Try
try {
System.Diagnostics.Process myProc = new System.Diagnostics.Process();
myProc.StartInfo.FileName = "c:\nonexist.exe";  //Attempting
 to start a non-existing executable
myProc.Start();    //Start the application and assign it to the process
 component.    
}
  catch(Win32Exception w) {
Console.WriteLine(w.Message);
Console.WriteLine(w.ErrorCode.ToString());
Console.WriteLine(w.NativeErrorCode.ToString());
Console.WriteLine(w.StackTrace);
Console.WriteLine(w.Source);
Exception e=w.GetBaseException();
Console.WriteLine(e.Message);
 }
try
{
   System::Diagnostics::Process^ myProc = gcnew System::Diagnostics::Process;
   //Attempting to start a non-existing executable
   myProc->StartInfo->FileName = "c:\nonexist.exe";
   //Start the application and assign it to the process component.
   myProc->Start();
}
catch ( Win32Exception^ w ) 
{
   Console::WriteLine( w->Message );
   Console::WriteLine( w->ErrorCode );
   Console::WriteLine( w->NativeErrorCode );
   Console::WriteLine( w->StackTrace );
   Console::WriteLine( w->Source );
   Exception^ e = w->GetBaseException();
   Console::WriteLine( e->Message );
}
継承階層継承階層
System.Object
   System.Exception
     System.SystemException
       System.Runtime.InteropServices.ExternalException
        System.ComponentModel.Win32Exception
           System.Net.HttpListenerException
           System.Net.NetworkInformation.NetworkInformationException
           System.Net.Sockets.SocketException
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Win32Exception コンストラクタ ()

最後に発生した Win32 エラー使用して、Win32Exception クラス新しインスタンス初期化します。

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

Dim instance As New Win32Exception
public Win32Exception ()
public:
Win32Exception ()
public Win32Exception ()
public function Win32Exception ()
解説解説
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Win32Exception コンストラクタ (Int32)

指定したエラー使用して、Win32Exception クラス新しインスタンス初期化します。

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

public Win32Exception (
    int error
)
public:
Win32Exception (
    int error
)
public Win32Exception (
    int error
)
public function Win32Exception (
    error : int
)

パラメータ

error

この例外関連付けられている Win32 エラー コード

解説解説
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Win32Exception コンストラクタ (Int32, String)

指定したエラー詳細説明使用して、Win32Exception クラス新しインスタンス初期化します。

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

解説解説
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Win32Exception コンストラクタ (SerializationInfo, StreamingContext)

指定したコンテキスト情報シリアル化情報で、Win32Exception クラス新しインスタンス初期化します。

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

Protected Sub New ( _
    info As SerializationInfo, _
    context As StreamingContext _
)
Dim info As SerializationInfo
Dim context As StreamingContext

Dim instance As New Win32Exception(info,
 context)
protected Win32Exception (
    SerializationInfo info,
    StreamingContext context
)
protected:
Win32Exception (
    SerializationInfo^ info, 
    StreamingContext context
)
protected Win32Exception (
    SerializationInfo info, 
    StreamingContext context
)
protected function Win32Exception (
    info : SerializationInfo, 
    context : StreamingContext
)

パラメータ

info

この例外関連付けられた SerializationInfo。

context

この例外コンテキストを表す StreamingContext オブジェクト

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Win32Exception コンストラクタ (String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

詳細説明指定して、Win32Exception クラス新しインスタンス初期化します。

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

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Win32Exception コンストラクタ (String, Exception)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

詳細説明例外指定して、Win32Exception クラス新しインスタンス初期化します。

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

Public Sub New ( _
    message As String, _
    innerException As Exception _
)
Dim message As String
Dim innerException As Exception

Dim instance As New Win32Exception(message,
 innerException)
public Win32Exception (
    string message,
    Exception innerException
)
public:
Win32Exception (
    String^ message, 
    Exception^ innerException
)
public Win32Exception (
    String message, 
    Exception innerException
)
public function Win32Exception (
    message : String, 
    innerException : Exception
)

パラメータ

message

エラー詳細説明

innerException

この例外原因である内部例外への参照

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Win32Exception コンストラクタ


Win32Exception プロパティ


パブリック プロパティパブリック プロパティ

プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外割り当てられているコード化数値である HRESULT を取得または設定します。 ( Exception から継承されます。)
参照参照

関連項目

Win32Exception クラス
System.ComponentModel 名前空間

Win32Exception メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Win32Exception クラス
System.ComponentModel 名前空間

Win32Exception メンバ

Win32 エラー コード例外スローさます。

Win32Exception データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
プロテクト コンストラクタプロテクト コンストラクタ
パブリック プロパティパブリック プロパティ
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外割り当てられているコード化数値である HRESULT を取得または設定します。(Exception から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Win32Exception クラス
System.ComponentModel 名前空間



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

辞書ショートカット

すべての辞書の索引

「Win32Exception」の関連用語

Win32Exceptionのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS