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) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「Win32Exception クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS