VMS0000MZ.cpp 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <windows.h>
  4. #define __PLUGIN_DLL_EXPORT__
  5. #include "VMS0000MZ.h"
  6. #include "AppGlobalF.h"
  7. #include "ITSDbF.h"
  8. #include "FrmVmsMsgFormMngrF.h"
  9. #include "FrmVmsMsgSymbMngrF.h"
  10. #include "FrmVmsMsgVideoMngrF.h"
  11. #include "FrmVmsMsgScheMngrF.h"
  12. #include "FrmVmsLcsScheMngrF.h"
  13. #include "FrmVmsMsgRespMngrF.h"
  14. #include "FrmVmsMsgDfltMngrF.h"
  15. #include "FrmVmsMsgPubrMngrF.h"
  16. #include "FrmVmsMsgUserDispF.h"
  17. #include "FrmVmsModuleSttsF.h"
  18. #include "FrmVmsMsgDsplPrstF.h"
  19. // VmsMsgFormMngr
  20. USEFORM("..\VmsMsgFormMngr\SRC\FrmVmsMsgFormMngrF.cpp", FrmVmsMsgFormMngr);
  21. USEFORM("..\VmsMsgFormMngr\SRC\VMSM510MF.cpp", VMSM510M);
  22. USEFORM("..\VmsMsgFormMngr\SRC\VMSM520MF.cpp", VMSM520M);
  23. USEFORM("..\VmsMsgFormMngr\SRC\VMSM530MF.cpp", VMSM530M);
  24. USEFORM("..\VmsMsgFormMngr\SRC\VMSM540MF.cpp", VMSM540M);
  25. USEFORM("..\VmsMsgFormMngr\SRC\VMSM570MF.cpp", VMSM570M);
  26. USEFORM("..\VmsMsgFormMngr\SRC\VMSM580MF.cpp", VMSM580M);
  27. USEFORM("..\VmsMsgFormMngr\SRC\VMSM590MF.cpp", VMSM590M);
  28. // VmsMsgSymbMngr
  29. USEFORM("..\VmsMsgSymbMngr\SRC\FrmVmsMsgSymbMngrF.cpp", FrmVmsMsgSymbMngr);
  30. // VmsMsgVideoMngr
  31. USEFORM("..\VmsMsgVideoMngr\SRC\FrmVmsMsgVideoMngrF.cpp", FrmVmsMsgVideoMngr);
  32. // VmsMsgScheMngr
  33. USEFORM("..\VmsMsgScheMngr\SRC\FrmVmsMsgScheMngrF.cpp", FrmVmsMsgScheMngr);
  34. USEFORM("..\VmsMsgScheMngr\SRC\VMSM610MF.cpp", VMSM610M);
  35. // VmsLcsScheMngr
  36. USEFORM("..\VmsLcsScheMngr\SRC\FrmVmsLcsScheMngrF.cpp", FrmVmsLcsScheMngr);
  37. USEFORM("..\VmsLcsScheMngr\SRC\FrmVmsLcsSelTermF.cpp", FrmVmsPubrSelTerm);
  38. // VmsMsgRespMngr
  39. USEFORM("..\VmsMsgRespMngr\SRC\FrmVmsMsgRespMngrF.cpp", FrmVmsMsgRespMngr);
  40. // VmsMsgDfltMngr
  41. USEFORM("..\VmsMsgDfltMngr\SRC\FrmVmsMsgDfltMngrF.cpp", FrmVmsMsgDfltMngr);
  42. // VmsMsgPubrMngr
  43. USEFORM("..\VmsMsgPubrMngr\SRC\FrmVmsPubrSelTermF.cpp", FrmVmsPubrSelTerm);
  44. USEFORM("..\VmsMsgPubrMngr\SRC\FrmVmsMsgPubrMngrF.cpp", FrmVmsMsgPubrMngr);
  45. // VmsMsgEmgrMngr
  46. USEFORM("..\VmsMsgEmgrMngr\SRC\FrmVmsMsgEmgrMngrF.cpp", FrmVmsMsgEmgrMngr);
  47. USEFORM("..\VmsMsgEmgrMngr\SRC\FrmVmsEmgrSelTermF.cpp", FrmVmsEmgrSelTerm);
  48. // VmsMsgUserDisp
  49. USEFORM("..\VmsMsgUserDisp\SRC\FrmVmsMsgUserDispF.cpp", FrmVmsMsgUserDisp);
  50. USEFORM("..\VmsMsgUserDisp\SRC\FrmVmsFormSelF.cpp", FrmVmsFormSel);
  51. USEFORM("..\VmsMsgUserDisp\SRC\VMSM510MF.cpp", VMSM510M);
  52. // VmsRemoteCtrl
  53. USEFORM("..\VmsRemoteCtrl\SRC\FrmVmsRemoteCtrlF.cpp", FrmVmsRemoteCtrl);
  54. // VmsModuleStts
  55. USEFORM("..\VmsModuleStts\SRC\FrmVmsModuleSttsF.cpp", FrmVmsModuleStts);
  56. // VmsMsgDsplPrst
  57. USEFORM("..\VmsMsgDsplPrst\SRC\FrmVmsMsgDsplPrstF.cpp", FrmVmsMsgDsplPrst);
  58. // VmsMsgDsplSche
  59. USEFORM("..\VmsMsgDsplSche\SRC\FrmVmsMsgDsplScheF.cpp", FrmVmsMsgDsplSche);
  60. USEFORM("..\VmsMsgDsplSche\SRC\VMS0201MF.cpp", VMS0201M);
  61. #pragma hdrstop
  62. //---------------------------------------------------------------------------
  63. // Important note about DLL memory management when your DLL uses the
  64. // static version of the RunTime Library:
  65. //
  66. // If your DLL exports any functions that pass String objects (or structs/
  67. // classes containing nested Strings) as parameter or function results,
  68. // you will need to add the library MEMMGR.LIB to both the DLL project and
  69. // any other projects that use the DLL. You will also need to use MEMMGR.LIB
  70. // if any other projects which use the DLL will be performing new or delete
  71. // operations on any non-TObject-derived classes which are exported from the
  72. // DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
  73. // EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
  74. // the file BORLNDMM.DLL should be deployed along with your DLL.
  75. //
  76. // To avoid using BORLNDMM.DLL, pass string information using "char *" or
  77. // ShortString parameters.
  78. //
  79. // If your DLL uses the dynamic version of the RTL, you do not need to
  80. // explicitly add MEMMGR.LIB as this will be done implicitly for you
  81. //---------------------------------------------------------------------------
  82. #pragma argsused
  83. #define STRICT
  84. #include <windows.h>
  85. #include <algorithm>
  86. using std::min;
  87. using std::max;
  88. #include "gdiplus.h"
  89. #include "GdiplusBase.h" //항상 넣어 둔다.
  90. class CGdiPlusStarter
  91. {
  92. private:
  93. ULONG_PTR m_gpToken;
  94. public:
  95. bool m_bSuccess;
  96. CGdiPlusStarter()
  97. {
  98. ::CoInitialize(NULL);
  99. Gdiplus::GdiplusStartupInput gpsi;
  100. m_bSuccess = (Gdiplus::GdiplusStartup(&m_gpToken, &gpsi, NULL) == Gdiplus::Ok);
  101. dxInitialize();
  102. }
  103. ~CGdiPlusStarter()
  104. {
  105. dxInitialize();
  106. Gdiplus::GdiplusShutdown(m_gpToken);
  107. ::CoUninitialize();
  108. }
  109. };
  110. CGdiPlusStarter g_gps;
  111. //---------------------------------------------------------------------------
  112. bool InitializeApplication() {
  113. static bool isInitializeApplication = true;
  114. if (isInitializeApplication) {
  115. ShowMessage("InitializeApplication");
  116. DateSeparator = '-';
  117. TimeSeparator = ':';
  118. ShortDateFormat ="yyyy-MM-dd";
  119. ShortTimeFormat = "hh:nn:ss";
  120. LongTimeFormat = "hh:nn:ss";
  121. cxFormatController()->BeginUpdate();
  122. cxFormatController()->UseDelphiDateTimeFormats = true;
  123. cxFormatController()->EndUpdate();
  124. cxFormatController()->GetFormats();
  125. cxFormatController()->NotifyListeners();
  126. g_sAppDir = ExtractFilePath(Application->ExeName);
  127. g_sAppName = ChangeFileExt(ExtractFileName(Application->ExeName), "");
  128. g_sCfgDir = g_sAppDir + g_IniFileDir + "\\";
  129. g_sLogDir = g_sAppDir + "Log\\";
  130. ForceDirectories(g_sLogDir.c_str());
  131. ChDir(g_sAppDir);
  132. /*
  133. * 시스템 운영환경을 ini 파일에서 읽어 온다.
  134. */
  135. LoadDefaultConfigInfo(g_IniFileName);
  136. ITSLog = new TITSLog(g_sLogDir, g_sAppName, g_AppCfg.sLogDay);
  137. ITSLog->FLogCfg = g_LogCfg;
  138. if (!ITSDb_Initialize()) {
  139. Application->MessageBox(L"Database 자원을 시스템으로부터 얻지 못했습니다.\r\n\r\n프로그램을 종료합니다.",
  140. L"프로그램 시작 오류!!!",
  141. MB_OK|MB_ICONERROR);
  142. return false;
  143. }
  144. if (g_AppCfg.itsdb.sConnectStr == "") {
  145. ITSDb_SetInfo(g_AppCfg.itsdb.sProvider, g_AppCfg.itsdb.sServerName, g_AppCfg.itsdb.sUserName, g_AppCfg.itsdb.sPassword);
  146. }
  147. else {
  148. ITSDb_SetConnStr(g_AppCfg.itsdb.sConnectStr);
  149. }
  150. if (!ITSDb_Open()) {
  151. Application->MessageBox(L"데이터베이스 접속에 실패하였습니다.\r\n\r\n프로그램을 종료합니다.",
  152. L"프로그램 시작 오류!!!",
  153. MB_OK|MB_ICONERROR);
  154. return false;
  155. }
  156. isInitializeApplication = false;
  157. }
  158. return true;
  159. }
  160. //---------------------------------------------------------------------------
  161. PLUGIN_LIB int __stdcall ShowVmsMsgFormMngr(HWND AOwner, int AShowType, String AOperId)
  162. {
  163. ShowMessage(AOperId);
  164. if (FrmVmsMsgFormMngr != NULL) {
  165. FrmVmsMsgFormMngr->BringToFront();
  166. return 0;
  167. }
  168. if (!InitializeApplication()) {
  169. return -1;
  170. }
  171. FrmVmsMsgFormMngr = new TFrmVmsMsgFormMngr(NULL);
  172. #if 0
  173. if (AShowType == e_mdichild) {
  174. FrmVmsMsgFormMngr->FormStyle = fsMDIChild;
  175. FrmVmsMsgFormMngr->Show();
  176. }
  177. else
  178. if (AShowType == e_modal) {
  179. FrmVmsMsgFormMngr->FormStyle = fsMDIChild;
  180. FrmVmsMsgFormMngr->ShowModal();
  181. }
  182. else {
  183. FrmVmsMsgFormMngr->FormStyle = fsMDIChild;
  184. FrmVmsMsgFormMngr->Show();
  185. }
  186. #else
  187. FrmVmsMsgFormMngr->Show();
  188. #endif
  189. return 0;
  190. }
  191. //---------------------------------------------------------------------------
  192. PLUGIN_LIB int __stdcall ShowVmsMsgFormMngr2()
  193. {
  194. if (!InitializeApplication()) {
  195. return -1;
  196. }
  197. FrmVmsMsgFormMngr = new TFrmVmsMsgFormMngr(NULL);
  198. FrmVmsMsgFormMngr->Show();
  199. return 0;
  200. }
  201. //---------------------------------------------------------------------------
  202. PLUGIN_LIB int __stdcall ShowVmsMsgSymbMngr(HWND AOwner, int AShowType, String AOperId)
  203. {
  204. ShowMessage(AOperId);
  205. if (FrmVmsMsgSymbMngr != NULL) {
  206. FrmVmsMsgSymbMngr->BringToFront();
  207. return 0;
  208. }
  209. if (!InitializeApplication()) {
  210. return -1;
  211. }
  212. FrmVmsMsgSymbMngr = new TFrmVmsMsgSymbMngr(NULL);
  213. #if 0
  214. if (AShowType == e_mdichild) {
  215. FrmVmsMsgSymbMngr->FormStyle = fsMDIChild;
  216. FrmVmsMsgSymbMngr->Show();
  217. }
  218. else
  219. if (AShowType == e_modal) {
  220. FrmVmsMsgSymbMngr->FormStyle = fsMDIChild;
  221. FrmVmsMsgSymbMngr->ShowModal();
  222. }
  223. else {
  224. FrmVmsMsgSymbMngr->FormStyle = fsMDIChild;
  225. FrmVmsMsgSymbMngr->Show();
  226. }
  227. #else
  228. FrmVmsMsgSymbMngr->Show();
  229. #endif
  230. return 0;
  231. }
  232. //---------------------------------------------------------------------------
  233. PLUGIN_LIB int __stdcall ShowVmsMsgSymbMngr2()
  234. {
  235. if (!InitializeApplication()) {
  236. return -1;
  237. }
  238. FrmVmsMsgSymbMngr = new TFrmVmsMsgSymbMngr(NULL);
  239. FrmVmsMsgSymbMngr->Show();
  240. return 0;
  241. }
  242. //---------------------------------------------------------------------------
  243. int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
  244. {
  245. if (reason == DLL_PROCESS_DETACH)
  246. {
  247. try {
  248. } catch(...) {}
  249. }
  250. return 1;
  251. }
  252. //---------------------------------------------------------------------------