FormatMessage
来源:互联网 发布:皮影客一样的软件 编辑:程序博客网 时间:2024/05/09 00:02
Private Const FORMAT_MESSAGE_ALLOCATE_BUFFER As Long = 256Private Const FORMAT_MESSAGE_IGNORE_INSERTS As Long = 512Private Const FORMAT_MESSAGE_FROM_STRING As Long = 1024Private Const FORMAT_MESSAGE_FROM_HMODULE As Long = 2048Private Const FORMAT_MESSAGE_FROM_SYSTEM As Long = 4096Private Const FORMAT_MESSAGE_ARGUMENT_ARRAY As Long = 8192Private Const FORMAT_MESSAGE_MAX_WIDTH_MASK As Long = 255Private Const LANG_NEUTRAL As Long = &H0Private Const SUBLANG_DEFAULT As Long = &H1Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyW" (ByRef lpString1 As Byte, ByVal lpString2 As Long) As LongPrivate Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageW" (ByVal dwFlags As Long, ByVal lpSource As Long, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As Long, ByVal nSize As Long, ByVal Arguments As Long) As LongPrivate Declare Function LocalFree Lib "kernel32" (ByVal hMem As Any) As LongPrivate Function MAKELANGID(ByVal p As Long, ByVal s As Long) As Long MAKELANGID = (CLng(CInt(s)) * 1024) Or CLng(CInt(p))End FunctionPrivate Function GetErrorText(ByVal dwErrorCode As Long) As String Dim dwMessageLength As Long, lpBuffer As Long Dim bBuffer() As Byte dwMessageLength = FormatMessage( _ FORMAT_MESSAGE_ALLOCATE_BUFFER Or FORMAT_MESSAGE_FROM_SYSTEM Or FORMAT_MESSAGE_IGNORE_INSERTS, _ 0, _ dwErrorCode, _ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), _ VarPtr(lpBuffer), _ 0, _ 0) If dwMessageLength = 0 Then GetErrorText = "" Else ReDim bBuffer(dwMessageLength + dwMessageLength + 2) Call lstrcpy(bBuffer(0), lpBuffer) GetErrorText = bBuffer Erase bBuffer Call LocalFree(lpBuffer) End IfEnd Function
- FormatMessage
- FormatMessage
- FormatMessage
- FormatMessage
- FormatMessage
- FormatMessage
- FormatMessage
- formatmessage
- FormatMessage &GetLastError
- FormatMessage 浅析
- FormatMessage函数
- FormatMessage例程
- C++ FormatMessage
- FormatMessage 用法
- FormatMessage函数
- FormatMessage函数
- FormatMessage 函数
- some FormatMessage wrapper
- java.util.ConcurrentModificationException--What it means
- MP4容器格式分析1
- JM8.5中的多参考帧问题
- 云计算
- php小练习
- FormatMessage
- JSP中重要的方法------URLREWRITE
- ios object-c中property(属性)的作用和类别分析
- 查看MYSQL连接数和服务器状态
- POJ 1047
- c语言逻辑运算符使用分析.
- Ext.Button组件的基本用法
- iphone视图间跳转之三:导航栏控制器
- Ubuntu 12.04安装Flash plugin for Firefox