Source code of Windows XP (NT5)
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.

69 lines
1.6 KiB

  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <stdarg.h>
  4. class CTextBlock
  5. {
  6. private:
  7. PTCHAR m_pText;
  8. PTCHAR m_pEndOfBuffer;
  9. BOOL m_isFixedWidth;
  10. BOOL m_isUseTabs;
  11. BOOL m_isUseCRLF;
  12. UINT m_colCount;
  13. UINT m_currentCol;
  14. UINT m_colWidth[10];
  15. HANDLE m_hMemory;
  16. HINSTANCE m_hResource;
  17. public:
  18. CTextBlock();
  19. ~CTextBlock();
  20. void SetColumnCount(UINT colCount) {m_colCount = colCount;};
  21. void SetFixedColumnWidth(BOOL isFixedWidth) {m_isFixedWidth = isFixedWidth;};
  22. void SetColumnWidth(UINT col, UINT colWidth);
  23. void SetUseTabs(BOOL isUseTabs) {m_isUseTabs = isUseTabs;};
  24. void SetResourceHandle(HINSTANCE hResource) {m_hResource = hResource;};
  25. void SetUseCRLF(BOOL isUseCRLF) {m_isUseCRLF = isUseCRLF;};
  26. PTCHAR GetBuffer(void) {return m_pText;};
  27. HANDLE GetHandle(void) {return m_hMemory;};
  28. void __cdecl WriteToBuffer(PTCHAR cFormat, ...);
  29. void WriteToBufferLL(LONGLONG number);
  30. void WriteToBuffer(UINT resourceID); // to write a resource string
  31. void WriteTab(void);
  32. void WriteNULL(void);
  33. void WriteByteCount(LONGLONG byteCount);
  34. void EndOfLine(void);
  35. void FormatNum(HINSTANCE hResource, LONGLONG number, PTCHAR buffer);
  36. // write the text to a UNICODE file
  37. BOOL StoreFile(IN TCHAR* cStoreFileName, IN DWORD dwCreate);
  38. private:
  39. void WriteToBufferAndPad(PTCHAR buffer, UINT length);
  40. };
  41. DWORD
  42. FormatNumber(
  43. HINSTANCE hResource,
  44. LONGLONG Number,
  45. PTCHAR buffer
  46. );
  47. DWORD
  48. FormatNumberMB(
  49. HINSTANCE hResource,
  50. LONGLONG number,
  51. PTCHAR buffer
  52. );
  53. PTCHAR
  54. CommafyNumber(
  55. LONGLONG number,
  56. PTCHAR stringBuffer,
  57. UINT stringBufferLength
  58. );