Global.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <tchar.h>
  9. #include <vector>
  10. #include <string>
  11. using namespace std;
  12. namespace Global
  13. {
  14. //////////////////////////////////////////////////////////////////////////
  15. // 全局变量;
  16. extern TCHAR g_szCurModuleDir[MAX_PATH];
  17. extern TCHAR g_szCurModulePath[MAX_PATH];
  18. extern TCHAR g_szFna[MAX_PATH];
  19. extern TCHAR g_szConfig[MAX_PATH];
  20. extern bool g_bEnableLog;
  21. extern TCHAR g_szLogPath[MAX_PATH];
  22. extern time_t g_time;
  23. typedef struct _TLOG_{
  24. string report_type;
  25. string report_data;
  26. }TLog, *pTLog;
  27. //////////////////////////////////////////////////////////////////////////
  28. // 全局函数;
  29. void Init();
  30. bool GetVersion(IN const TCHAR *fname, OUT WORD *pdwFileVersion, OUT WORD *pdwProductVerion);
  31. BOOL GetVersion(IN HMODULE hModule, OUT DWORD(&dwFVArray)[4], OUT DWORD(&dwPVArray)[4]);
  32. void WriteTextLog(const TCHAR *format, ...);
  33. void WritePythonLog(const TCHAR *format, ...);
  34. std::string EnCode_UTF8URL(IN const CHAR* pText);
  35. std::string &trim(std::string &str);
  36. // 字符串是否由数字、字母、符号组成;
  37. BOOL IsValidString(LPCTSTR lpszString);
  38. string DeCode_URLUNICODE(IN const CHAR* pURLText);
  39. };