DllImportAttribute.SetLastError フィールド
アセンブリ: mscorlib (mscorlib.dll 内)


呼び出し先が SetLastError を呼び出すことを示す場合は true。それ以外の場合は false。既定値は false です (Visual Basic を除く)。
ランタイム マーシャラは GetLastError を呼び出し、返された値をキャッシュに格納して、他の API 呼び出しによる上書きを防止します。GetLastWin32Error を呼び出して、エラー コードを取得できます。

場合によっては、Visual Basic の開発者は、マネージ コードで DLL 関数を定義する際、Declare ステートメントを使用する代わりに、DllImportAttribute を使用します。SetLastError フィールドの設定は、このような事例の 1 つです。
Imports System.Runtime.InteropServices Public Class Win32 <DllImport ("user32.dll", SetLastError := False)> _ Public Shared Function MessageBoxA (ByVal hWnd As Integer, _ ByVal txt As String, ByVal caption As String, _ ByVal Typ As Integer) As Integer End Function End Class

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDllImportAttribute.SetLastError フィールドを検索する場合は、下記のリンクをクリックしてください。

- DllImportAttribute.SetLastError フィールドのページへのリンク