Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Dword2Str.h
  5. Abstract:
  6. This file provides declaration for converting dwords to strings.
  7. Used in event logs.
  8. Author:
  9. Oded Sacher (OdedS) Dec, 200q
  10. Revision History:
  11. --*/
  12. #ifndef _FAX_DWORD_2_STR__H
  13. #define _FAX_DWORD_2_STR__H
  14. #include "faxutil.h"
  15. /************************************
  16. * *
  17. * Dword2String *
  18. * *
  19. ************************************/
  20. class Dword2String
  21. {
  22. public:
  23. Dword2String(DWORD dw) : m_dw(dw)
  24. {
  25. m_tszConvert[0] = TEXT('\0');
  26. }
  27. LPCTSTR Dword2Decimal()
  28. {
  29. _stprintf(m_tszConvert, TEXT("%ld"), m_dw);
  30. return m_tszConvert;
  31. }
  32. LPCTSTR Dword2Hex()
  33. {
  34. _stprintf(m_tszConvert, TEXT("0x%08X"),m_dw);
  35. return m_tszConvert;
  36. }
  37. private:
  38. DWORD m_dw;
  39. TCHAR m_tszConvert[12];
  40. };
  41. #define DWORD2DECIMAL(dwVal) Dword2String(dwVal).Dword2Decimal()
  42. #define DWORD2HEX(dwVal) Dword2String(dwVal).Dword2Hex()
  43. #endif