Global.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #pragma once
  2. #include <stdio.h>
  3. #include <locale.h>
  4. #include <stdlib.h>
  5. //#include <time.h> //或者 #include <ctime>
  6. #include <ctime>
  7. #include <io.h>
  8. #pragma comment(lib,"version.lib")
  9. #include <vector>
  10. #include <string>
  11. // GDI+
  12. #include <gdiplus.h>
  13. using namespace Gdiplus;
  14. #pragma comment(lib, "gdiplus.lib")
  15. #ifndef _UNICODE
  16. typedef string TString;
  17. #else
  18. typedef wstring TString;
  19. #endif
  20. namespace Global
  21. {
  22. typedef struct __ST_CONFIG__
  23. {
  24. // 是否启用测试精灵;
  25. bool enableTW;
  26. std::string strMIInitBat;
  27. std::string strSCBCInitBat;
  28. // test wizard
  29. int twPort;
  30. std::string twSignaldir;
  31. std::string twUseSignal;
  32. // ir-device;
  33. std::string redratpath;
  34. bool bGenerics;
  35. std::string signaldir;
  36. std::string use_signal;
  37. // SATService;
  38. bool bAutoLogin;
  39. std::string strSATUserName;
  40. std::string strSATPassword;
  41. std::string strActuator;
  42. std::string strServiceIP;
  43. std::string strServicePort;
  44. // UB530
  45. bool bAutoReconnect; // 是否启用自动重连;
  46. int nReconnectCycle; // 重连周期;
  47. }STConfig, * pSTConfig;
  48. //////////////////////////////////////////////////////////////////////////
  49. // 全局变量;
  50. extern TCHAR g_szCurModuleDir[MAX_PATH];
  51. extern TCHAR g_szCurModulePath[MAX_PATH];
  52. extern TCHAR g_szFna[MAX_PATH];
  53. extern TCHAR g_szConfig[MAX_PATH];
  54. extern TCHAR g_szResuorceCfg[MAX_PATH];
  55. extern STConfig g_Config;
  56. extern TCHAR g_szPython27Dir[MAX_PATH];
  57. extern ULONGLONG g_ulWaitTime;
  58. extern int g_nSysZoomRatio;
  59. //////////////////////////////////////////////////////////////////////////
  60. // 全局函数;
  61. void GetConfig();
  62. int ReadReg(char* path, char* key, char* value);
  63. BOOL Python27Dir();
  64. BOOL GetSysSerialPort(std::vector<std::string>& vtports);
  65. void WriteTextLog(const TCHAR* format, ...);
  66. void WriteTextLogEx(int nType, const TCHAR* format, ...);
  67. BOOL LoadImgFromFile(IN Image** pImg, LPCTSTR lpPath);
  68. BOOL LoadImgFromBuffer(IN Image** pImg, IN BYTE* pBuffer, IN CONST INT& nBufLen);
  69. BOOL LoadImgFromBuffer(IN Image** pImg, LPCTSTR lpPath);
  70. int GetEncoderClsid(IN CONST WCHAR* format, OUT CLSID* pClsid);
  71. Image* LoadImgFromResource(IN HMODULE hModule, IN LPCTSTR lpName, IN LPCTSTR lpType);
  72. BOOL SaveImgByRotate(LPCTSTR lpszFileName, BYTE* pBuffer, CONST INT& nBufLen, BOOL bHoriontal, BOOL bVertically);
  73. void MKDIR(LPCTSTR dir);
  74. bool GetVersion(OUT WORD* pdwFileVersion, OUT WORD* pdwProductVerion);
  75. void GetSysZoomRatio();
  76. };