CSystem.h 535 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. class CSystem
  3. {
  4. public:
  5. CSystem();
  6. ~CSystem();
  7. static int get_CPU_core_num();
  8. //程序休眠X秒
  9. static void my_sleep(int second);
  10. static std::wstring GetProgramDir()
  11. {
  12. wchar_t exeFullPath[MAX_PATH]; // Full path
  13. std::wstring strPath = L"";
  14. GetModuleFileName(NULL, exeFullPath, MAX_PATH);
  15. strPath = (wstring)exeFullPath; // Get full path of the file
  16. int pos = strPath.find_last_of('\\', strPath.length());
  17. return strPath.substr(0, pos); // Return the directory without the file name
  18. }
  19. };