FormatMessage 错误消息

来源:互联网 发布:小学生阅读软件下载 编辑:程序博客网 时间:2024/05/29 17:19
// Get the error codeDWORD dwError = GetDlgItemInt(IDC_EDIT1);HLOCAL hlocal = NULL;   // Buffer that gets the error message string// Use the default system locale since we look for Windows messages.// Note: this MAKELANGID combination has 0 as valueDWORD systemLocale = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);// Get the error code's textual descriptionBOOL fOk = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_ALLOCATE_BUFFER,NULL, dwError, systemLocale,(PTSTR) &hlocal, 0, NULL);SetDlgItemText(IDC_TEXTOUT,(PTSTR) LocalLock(hlocal));

0 0
原创粉丝点击