D
Dolphin White
I have imported the API FormatMessage from the module coredll.dll, just like
the sample PocketSignature of MSDN. But when I use the method, it throws a
NotSupportedException. I have tested the sample PocketSignature, it has the
same problem. I have no a real Pocket PC device now, so I can only test the
program in the VS 2003’s Pocket 2002 Emulator. But I think the API
FormatMessage is a very basal API, the Emulator should have supported it.
Why it throw the exception?
The list is the snippet of the code:
[DllImport("coredll.dll", CharSet=CharSet.Auto)]
private static extern uint FormatMessage(uint dwFlags, string lpSource, int
dwMessageId, uint dwLanguageId, StringBuilder lpBuffer, int nSize,string []
Arguments);
public static string FormatMessage(int errorCode)
{
StringBuilder sb = new StringBuilder(500);
try
{
// get message for last error
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, null, errorCode, 0,sb,
sb.Capacity, null);
}
catch
{
// error calling FormatMessage
sb.Append("N/A.");
}
return sb.ToString();
}
Thanks!
Dolphin
the sample PocketSignature of MSDN. But when I use the method, it throws a
NotSupportedException. I have tested the sample PocketSignature, it has the
same problem. I have no a real Pocket PC device now, so I can only test the
program in the VS 2003’s Pocket 2002 Emulator. But I think the API
FormatMessage is a very basal API, the Emulator should have supported it.
Why it throw the exception?
The list is the snippet of the code:
[DllImport("coredll.dll", CharSet=CharSet.Auto)]
private static extern uint FormatMessage(uint dwFlags, string lpSource, int
dwMessageId, uint dwLanguageId, StringBuilder lpBuffer, int nSize,string []
Arguments);
public static string FormatMessage(int errorCode)
{
StringBuilder sb = new StringBuilder(500);
try
{
// get message for last error
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, null, errorCode, 0,sb,
sb.Capacity, null);
}
catch
{
// error calling FormatMessage
sb.Append("N/A.");
}
return sb.ToString();
}
Thanks!
Dolphin