Global.cpp 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include "stdafx.h"
  3. #include "global.h"
  4. //·þÎñ
  5. TCHAR g_szServiceName[] = _T("isP-CMS Report Service");
  6. //*********************************************************
  7. //Functiopn: LogEvent
  8. //Description: ¼Ç¼·þÎñʼþ
  9. //Calls:
  10. //Called By:
  11. //Table Accessed:
  12. //Table Updated:
  13. //Input:
  14. //Output:
  15. //Return:
  16. //Others:
  17. //History:
  18. // <author>niying <time>2006-8-10 <version> <desc>
  19. //*********************************************************
  20. void LogEvent(LPCTSTR pFormat, ...)
  21. {
  22. TCHAR chMsg[256];
  23. HANDLE hEventSource;
  24. LPTSTR lpszStrings[1];
  25. va_list pArg;
  26. va_start(pArg, pFormat);
  27. _vstprintf(chMsg, pFormat, pArg);
  28. va_end(pArg);
  29. lpszStrings[0] = chMsg;
  30. hEventSource = RegisterEventSource(NULL, g_szServiceName);
  31. if (hEventSource != NULL)
  32. {
  33. ReportEvent(hEventSource, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (LPCTSTR*) &lpszStrings[0], NULL);
  34. DeregisterEventSource(hEventSource);
  35. }
  36. }