Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void LErr(TCHAR szFunc[] = NULL, DWORD dwErr = 0)
- {
- /*
- szFunc ... Function Name
- dwErr ... Error Code (it ccan be obtained by GetLastError() or sth)
- */
- LPVOID lpMsgBuf;
- TCHAR szMsg[4096] = { '\0' };
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErr,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)&lpMsgBuf, 0, NULL);
- swprintf_s(szMsg, 4096, _T("%s\r\n0x%08X (Dec:%u)"), lpMsgBuf, dwErr, dwErr);
- //MessageBox(NULL, szMsg, NULL, MB_OK);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement