[DllImport("coredll.dll", SetLastError=true)]
static extern Int32 GetLastError();
Declare Function GetLastError Lib "coredll.dll" () As Int32
None.
It is recommended that you do not call the Win32 GetLastError method directly. Because of the way P/Invoke works, the error message may get reset between Win32 calls in your code. Instead, call the Marshal.GetLastWin32Error method, which can be combined with the ever useful Marshal.ThrowExceptionForHR method. See below for an example.
You can look up Windows Mobile specific error codes here: http://msdn.microsoft.com/en-us/library/aa914935.aspx
C#
// don't use this!
Int32 lastError = GetLastError();
// use this:
int lastError = Marshal.GetLastWin32Error();
// or this:
Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error());
VB
// don't use!
Dim lastError As Int32
lastError = GetLastError()
// use this:
Dim lastError As int
lastError = Marshal.GetLastWin32Error()
// or
Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error())
Marshal.GetLastWin32Error();