log.cpp 752 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "Win32.h"
  2. #include "ID.h"
  3. #include "Function.h"
  4. static void Reflesh(HWND hwnd)
  5. {
  6. std::ifstream read;
  7. read.open("log.txt", std::ios::in);
  8. Err(&read, _T("Failed to open log.txt"));
  9. std::string text(
  10. (std::istreambuf_iterator<char>(read)),
  11. std::istreambuf_iterator<char>()
  12. );
  13. read.close();
  14. int len = MultiByteToWideChar(CP_ACP, 0, text.c_str(), -1, NULL, 0);
  15. std::wstring wtext(len, 0);
  16. MultiByteToWideChar(CP_ACP, 0, text.c_str(), -1, &wtext[0], len);
  17. SetWindowText(hwnd, wtext.c_str());
  18. }
  19. static void GetLog()
  20. {
  21. }
  22. void ClearLog()
  23. {
  24. std::ofstream output;
  25. output.open("log.txt", std::ios::out);
  26. output.close();
  27. }
  28. void Log(HWND hwnd)
  29. {
  30. GetLog();
  31. Reflesh(hwnd);
  32. }