Returns the HRESULT corresponding to the last error incurred by Win32 code executed using System.Runtime.InteropServices.Marshal.
![]()
The HRESULT corresponding to the last Win32 error code.
The target function must have had the setLastError metadata flag set. For example, the SetLastError field of the System.Runtime.InteropServices.DllImportAttribute must be true. The process for setting this flag depends on the source language used: C# and C++ are false by default, but the Declare statement in Visual Basic is true.