ErrorMessage.h
上传用户:ykzxjx
上传日期:2022-04-03
资源大小:1175k
文件大小:2k
开发平台:

Visual C++

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright 1999 - 2000 Mark Roddy
  4. // All Rights Reserved
  5. //
  6. // Hollis Technology Solutions
  7. // 94 Dow Road
  8. // Hollis, NH 03049
  9. // info@hollistech.com
  10. //
  11. // Synopsis: 
  12. // 
  13. //
  14. // Version Information:
  15. //
  16. // $Header: /iphook/usr/IpMonitor/ErrorMessage.h 2     1/27/00 10:35p Markr $ 
  17. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #ifndef ERROR_MESSAGE_H
  20. #define ERROR_MESSAGE_H
  21. __inline void AfxErrorMessage(CString& message, DWORD status)
  22. {
  23. LPVOID lpMsgBuf;
  24. FormatMessage( 
  25. FORMAT_MESSAGE_ALLOCATE_BUFFER | 
  26. FORMAT_MESSAGE_FROM_SYSTEM | 
  27. FORMAT_MESSAGE_IGNORE_INSERTS,
  28. NULL,
  29. status,
  30. MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
  31. (LPTSTR) &lpMsgBuf,
  32. 0,
  33. NULL 
  34. );
  35. if (message.Right(1) != _T(":")) {
  36. message += CString(": ");
  37. }
  38. message += CString((LPCTSTR) lpMsgBuf);
  39. LocalFree( lpMsgBuf );
  40. }
  41. __inline CString& AfxErrorMessageEx(CString& message, DWORD status)
  42. {
  43.     AfxErrorMessage(message, status);
  44.     return message;
  45. }
  46. __inline void AfxErrorMessageBox(CString& message, DWORD status)
  47. {
  48. AfxErrorMessage(message, status);
  49. AfxMessageBox( LPCTSTR(message));
  50. }
  51. #endif
  52. ///////////////////////////////////////////////////////////////////////////////
  53. // 
  54. // Change History Log
  55. //
  56. // $Log: /iphook/usr/IpMonitor/ErrorMessage.h $
  57. // 
  58. // 2     1/27/00 10:35p Markr
  59. // Prepare to release!
  60. //
  61. ///////////////////////////////////////////////////////////////////////////////