[DllImport("coredll", EntryPoint = "FormatMessageW", SetLastError = true)]
private static extern int FormatMessage(FormatMessageFlags dwFlags, IntPtr lpSource,
int dwMessageId, int dwLanguageId, System.Text.StringBuilder lpBuffer, int nSize, IntPtr[] Arguments);
Declare Function FormatMessageW Lib "coredll.dll" (TODO) As TODO
None.
Do you know one? Please contribute it!
See http://msdn2.microsoft.com/en-us/library/ms679351.aspx for details on the FormatMessage native method.
Please add some!
[DllImport("coredll", EntryPoint = "FormatMessageW", SetLastError = true)]
private static extern int FormatMessage(FormatMessageFlags dwFlags, IntPtr lpSource,
int dwMessageId, int dwLanguageId, System.Text.StringBuilder lpBuffer, int nSize, IntPtr[] Arguments);
[FlagsAttribute]
public enum FormatMessageFlags : int
{
FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000
}
public static string FormatWin32Message(int win32ErrorCode)
{
System.Text.StringBuilder sbMsg = new System.Text.StringBuilder(1024);
if (FormatMessage(FormatMessageFlags.FORMAT_MESSAGE_FROM_SYSTEM, IntPtr.Zero, win32ErrorCode, 0, sbMsg, sbMsg.Capacity, null) != 0)
return sbMsg.ToString();
else
return "Unrecognized Win32 error code";
}