RIMBAUD,20岁后失业,................................

Asp.Net,MONO

博客园 首页 新随笔 联系 订阅 管理
you can use the FormatMessage Win32 API. Sample projects for C# and VB.NET are enclosed. This is how the declaration looks like:


          [DllImport("Kernel32.dll")]
          public static extern int FormatMessage(int flags, IntPtr source, int messageId, int languageId, StringBuilder
               buffer, int size, IntPtr arguments );




Called like so:


// You can call FormatMessage to get a descriptive error message
                    StringBuilder sbFormatMessage = new StringBuilder(1024);
                    retVal = Interop.FormatMessage(Interop.FORMAT_MESSAGE_FROM_SYSTEM, IntPtr.Zero, Marshal.GetLastWin32Error(), 0, sbFormatMessage,
                         sbFormatMessage.Capacity, IntPtr.Zero);




Download C# sample, formatmessage.zip
Download VB.NET sample, formatmessage_VB.zip
posted on 2004-08-30 11:35  瓶子  阅读(588)  评论(0编辑  收藏  举报