VmsFormEdit.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <tchar.h>
  5. #include <cxFormats.hpp>
  6. //---------------------------------------------------------------------------
  7. #include "AppGlobalF.h"
  8. //---------------------------------------------------------------------------
  9. USEFORM("PLUGIN\VMSM500M\VMSM550MF.cpp", VMSM550M);
  10. USEFORM("PLUGIN\VMSM500M\VMSM540MF.cpp", VMSM540M);
  11. USEFORM("MAIN\FrmInitializeF.cpp", FrmInitialize);
  12. USEFORM("PLUGIN\VMSM500M\VMSM510MF.cpp", VMSM510M);
  13. USEFORM("PLUGIN\VMSM500M\FrmVmsFormEditF.cpp", FrmVmsFormEdit);
  14. USEFORM("PLUGIN\VMSM500M\VMSM530MF.cpp", VMSM530M);
  15. USEFORM("PLUGIN\VMSM500M\VMSM520MF.cpp", VMSM520M);
  16. //---------------------------------------------------------------------------
  17. WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
  18. {
  19. DateSeparator = '-';
  20. TimeSeparator = ':';
  21. ShortDateFormat ="yyyy-MM-dd";
  22. ShortTimeFormat = "hh:nn:ss";
  23. LongTimeFormat = "hh:nn:ss";
  24. int nRes;
  25. g_nPid = (int)GetCurrentProcessId();
  26. g_sAppDir = ExtractFilePath(Application->ExeName);
  27. g_sAppName = ChangeFileExt(ExtractFileName(Application->ExeName), "");
  28. g_sCfgDir = g_sAppDir + "Cfg\\";
  29. g_sLogDir = g_sAppDir + "Log\\";
  30. g_sTempDir = g_sAppDir + "Temp\\";
  31. g_sFormsDir = g_sCfgDir + "Forms\\";
  32. ForceDirectories(g_sCfgDir.c_str());
  33. ForceDirectories(g_sLogDir.c_str());
  34. String sAppDir = ExtractFilePath(Application->ExeName);
  35. ChDir(sAppDir);
  36. /*
  37. * 시스템 운영환경을 ini 파일에서 읽어 온다.
  38. */
  39. LoadDefaultConfigInfo("");
  40. ITSLog = new TITSLog(g_sLogDir, g_sAppName, g_AppCfg.sLogDay);
  41. ITSLog->FLogCfg = g_LogCfg;
  42. LOGINFO("Program start....");
  43. HANDLE hMutex;
  44. try
  45. {
  46. String sLockFile = ChangeFileExt(ExtractFileName(Application->ExeName), ".lock");
  47. String sProgMutexNm = "HANTE_PT_" + sLockFile;
  48. if ((hMutex=OpenMutex(MUTEX_ALL_ACCESS, false, sProgMutexNm.c_str()))==NULL)
  49. hMutex = CreateMutex(NULL, true, sProgMutexNm.c_str());
  50. else
  51. {
  52. LOGINFO("Program exit.... Program already running....");
  53. ActiveProgram();
  54. return 0;
  55. }
  56. }
  57. catch (Exception &exception)
  58. {
  59. LOGINFO("Program exit.... Exception Error....");
  60. Application->ShowException(&exception);
  61. return 0;
  62. }
  63. int nArgs = ParamCount();
  64. if (nArgs == 1) {
  65. if (!CheckParamRandKey(ParamStr(1))) {
  66. LOGINFO("Program exit.... Param Value Error....");
  67. goto prog_exit;
  68. }
  69. }
  70. else {
  71. LOGINFO("Program exit.... Param Count Error....");
  72. Application->MessageBox(L"\r\nVMS FORM 편집기 프로그램을 실행 할 수 없습니다.\r\n권한이 없습니다.\r\n",
  73. L"프로그램 실행 권한 오류!!!",
  74. MB_OK|MB_ICONERROR);
  75. goto prog_exit;
  76. }
  77. try
  78. {
  79. ReportMemoryLeaksOnShutdown = true;
  80. Application->Initialize();
  81. Application->MainFormOnTaskBar = true;
  82. Application->Title = "ITS VMS 폼 편집";
  83. Application->CreateForm(__classid(TFrmVmsFormEdit), &FrmVmsFormEdit);
  84. Application->Run();
  85. }
  86. catch (Exception &exception)
  87. {
  88. Application->ShowException(&exception);
  89. }
  90. catch (...)
  91. {
  92. try
  93. {
  94. throw Exception("");
  95. }
  96. catch (Exception &exception)
  97. {
  98. Application->ShowException(&exception);
  99. }
  100. }
  101. prog_exit:
  102. try
  103. {
  104. ReleaseMutex(hMutex);
  105. CloseHandle(hMutex);
  106. hMutex = NULL;
  107. LOGINFO("Program end....");
  108. }
  109. catch(...)
  110. {
  111. }
  112. return 0;
  113. }
  114. //---------------------------------------------------------------------------