Global.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include <stdio.h>
  3. #include <locale.h>
  4. #include <stdlib.h>
  5. #include <time.h> //或者 #include <ctime>
  6. #include <io.h>
  7. #pragma comment(lib,"version.lib")
  8. #include <vector>
  9. #include <string>
  10. using namespace std;
  11. namespace Global
  12. {
  13. //////////////////////////////////////////////////////////////////////////
  14. // 全局变量;
  15. extern TCHAR g_szCurModuleDir[MAX_PATH];
  16. extern TCHAR g_szCurModulePath[MAX_PATH];
  17. extern TCHAR g_szFna[MAX_PATH];
  18. extern TCHAR g_szConfig[MAX_PATH];
  19. extern TCHAR g_szPython27Dir[MAX_PATH];
  20. extern TCHAR g_szTVPort[MAX_PATH];
  21. extern TCHAR g_szTVReboot[MAX_PATH];
  22. extern TCHAR g_szTVShutdown[MAX_PATH];
  23. extern BOOL g_bWatchTVPort;
  24. extern bool g_bEnableLog;
  25. extern TCHAR g_szLogPath[MAX_PATH];
  26. extern COleDateTime g_lastTime;
  27. extern time_t g_time;
  28. extern FILE *gp_log_fp;
  29. //////////////////////////////////////////////////////////////////////////
  30. // 全局函数;
  31. bool GetVersion(IN const TCHAR *fname, OUT WORD *pdwFileVersion, OUT WORD *pdwProductVerion);
  32. BOOL GetVersion(IN HMODULE hModule, OUT DWORD(&dwFVArray)[4], OUT DWORD(&dwPVArray)[4]);
  33. void WriteTextLog(const TCHAR *format, ...);
  34. void WritePythonLog(LPCTSTR file, const TCHAR* msg);
  35. void ClosePythonLog();
  36. std::string EnCode_UTF8URL(IN const CHAR* pText);
  37. std::string &trim(std::string &str);
  38. bool MKDIR(LPCTSTR dir);
  39. // 字符串是否由数字、字母、符号组成;
  40. BOOL IsValidString(LPCTSTR lpszString);
  41. string DeCode_URLUNICODE(IN const CHAR* pURLText);
  42. BOOL Python27Dir();
  43. void GetResourceCfg();
  44. void Split(std::string str1, std::string str2, std::vector<std::string> &vt);
  45. };