AppGlobalF.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. //---------------------------------------------------------------------------
  2. #ifndef AppGlobalFH
  3. #define AppGlobalFH
  4. //---------------------------------------------------------------------------
  5. #include <map.h>
  6. #include "ITSUtilF.h"
  7. #include "ITSLogF.h"
  8. //---------------------------------------------------------------------------
  9. /*
  10. ******************************************************************************
  11. * Defines
  12. ******************************************************************************
  13. */
  14. #define FORMSHOW(x) if (x) \
  15. { \
  16. try { \
  17. ShowWindow(x->Handle, SW_RESTORE); \
  18. x->BringToFront(); \
  19. } catch(...) {} \
  20. } \
  21. else \
  22. { \
  23. Application->CreateForm(__classid(T##x), &x); \
  24. if (x) x->Show(); \
  25. }
  26. typedef struct tag_AppConfig
  27. {
  28. String sConfigFile;
  29. bool bAppClose;
  30. long lMainWinHandle; /* Main Window Handle */
  31. String sTitle;
  32. String sProcessId; /* ÇÁ·Î¼¼½º ID */
  33. int nVmsServerPort;
  34. String sSkinName;
  35. bool bSaveForm;
  36. bool bLoginPrompt;
  37. String sDefUseId;
  38. int nLogLevel;
  39. AnsiString sLogDay;
  40. bool bDebug;
  41. String sAppPath;
  42. String sLang;
  43. String sEmptyImg;
  44. bool isDispOfflineMsg;
  45. struct
  46. {
  47. bool Window;
  48. bool Enabled;
  49. int TimeOut;
  50. } Alarm;
  51. struct
  52. {
  53. bool Window;
  54. bool Enabled;
  55. int TimeOut;
  56. } Incident;
  57. struct
  58. {
  59. int AlarmValue;
  60. } Temp;
  61. struct
  62. {
  63. bool Enabled;
  64. int IntervalMin;
  65. bool LogoutExit;
  66. } AutoLogout;
  67. struct
  68. {
  69. TThread *pThread;
  70. DWORD dwThreadId;
  71. unsigned int nHandle;
  72. bool bRunning;
  73. } thr;
  74. struct
  75. {
  76. String sConnectStr;
  77. String sProvider;
  78. String sServerName;
  79. String sUserName;
  80. String sPassword;
  81. bool bSqlLog;
  82. } itsdb;
  83. struct
  84. {
  85. String sProvider;
  86. String sServerName;
  87. String sUserName;
  88. String sPassword;
  89. bool bSqlLog;
  90. } utisdb;
  91. struct
  92. {
  93. String sMainMap;
  94. String sLinkMap;
  95. } flashmap;
  96. struct
  97. {
  98. String sComModel;
  99. String sDevModel;
  100. } vmscam;
  101. struct
  102. {
  103. String saveDir;
  104. String viewer;
  105. String server;
  106. int port;
  107. String user;
  108. String pswd;
  109. String dir;
  110. } blackbox;
  111. struct
  112. {
  113. String SERVER;
  114. int PORT;
  115. String USER;
  116. String PSWD;
  117. bool PASSIVE;
  118. } vmsFtp;
  119. bool bOnlyOneScreen;
  120. bool bTermChildProg;
  121. bool isLoadFromFile;
  122. String MAGIC_ID;
  123. String OPER_ID;
  124. String PRCS_ID;
  125. String PARAM1;
  126. String PARAM2;
  127. String PARAM3;
  128. String PARAM4;
  129. } APP_CONFIG;
  130. #define DEFAULT_PRCS_ID "P08010"
  131. /*
  132. ******************************************************************************
  133. * Global variable definitions
  134. ******************************************************************************
  135. */
  136. extern String g_IniFileDir;
  137. extern String g_IniFileName;
  138. extern int g_nPid; // Application Process ID
  139. extern String g_sAppDir; // Application Directory
  140. extern String g_sAppName; // Program name
  141. extern String g_sCfgDir; // Config File Directory
  142. extern String g_sLogDir; // Program Log Directory
  143. extern String g_sTempDir; // Program Temp Directory
  144. extern String g_sFormsDir; // Program Forms Directory
  145. extern String g_sBlackBox;
  146. extern String g_sLangDir;
  147. extern String g_sImageDir;
  148. extern String g_sVideoDir;
  149. extern String g_sMapDir;
  150. extern LOG_INFO g_LogCfg;
  151. extern TITSLog *ITSLog;
  152. extern APP_CONFIG g_AppCfg;
  153. //extern LOG_INFO g_LogCfg;
  154. //extern TITSLog *ITSLog;
  155. extern String g_sLang;
  156. extern bool g_bControlAuth;
  157. /*
  158. ******************************************************************************
  159. * PlugIn Global variables
  160. ******************************************************************************
  161. */
  162. /*
  163. ******************************************************************************
  164. * Global function definitios
  165. ******************************************************************************
  166. */
  167. String DbPictTypeToReal(String APictType);
  168. String RealPictTypeToDb(String APictType);
  169. String DbMovieTypeToReal(String APictType);
  170. String RealMovieTypeToDb(String APictType);
  171. bool CheckApplicationParam();
  172. bool ApplicationSingleRun(String AClassName, String ATitle);
  173. bool LoadDefaultConfigInfo(String ACfgFile="");
  174. bool WriteConfigInfo(String sCfgFile, String sTitle, String sItem, String sValue);
  175. bool ReadConfigInfo(String sCfgFile, String sTitle, String sItem, String &sValue);
  176. bool DeleteLogFiles(PTCHAR pszPath, int nDays, PTCHAR pszFile);
  177. void ShowErrorMsg(String ATitle, String AErrMsg);
  178. #include "cxControls.hpp"
  179. #include "cxDropDownEdit.hpp"
  180. TDateTime APP_StrToDateTime(String AStrDateTime);
  181. //----------------------------------------------------------------------------
  182. ULONG ProcIDFromWnd(HWND hwnd);
  183. HWND GetWinHandle(ULONG pid);
  184. #endif