LangEdit.cpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <tchar.h>
  5. #include <cxFormats.hpp>
  6. //---------------------------------------------------------------------------
  7. #include "AppGlobalF.h"
  8. //#include "ResourceMsgF.h"
  9. #include "ITSDbF.h"
  10. //---------------------------------------------------------------------------
  11. USEFORM("MAIN\FrmLangEditF.cpp", FrmLangEdit);
  12. //---------------------------------------------------------------------------
  13. WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
  14. {
  15. int nLoginRes;
  16. DateSeparator = '-';
  17. TimeSeparator = ':';
  18. ShortDateFormat = "yyyy-MM-dd";
  19. ShortTimeFormat = "HH:NN:SS";
  20. LongTimeFormat = "HH:NN:SS";
  21. cxFormatController()->BeginUpdate();
  22. cxFormatController()->UseDelphiDateTimeFormats = true;
  23. cxFormatController()->EndUpdate();
  24. cxFormatController()->GetFormats();
  25. cxFormatController()->NotifyListeners();
  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_sFormsDir = g_sCfgDir + "Forms\\";
  31. ForceDirectories(g_sCfgDir.c_str());
  32. ForceDirectories(g_sLogDir.c_str());
  33. String sTempDir = g_sLogDir + "Db\\";
  34. ForceDirectories(sTempDir.c_str());
  35. String sAppDir = ExtractFilePath(Application->ExeName);
  36. ChDir(sAppDir);
  37. /*
  38. * 시스템 운영환경을 ini 파일에서 읽어 온다.
  39. */
  40. LoadDefaultConfigInfo("ITS_OP");
  41. ITSLog = new TITSLog(g_sLogDir, g_sAppName, g_AppCfg.sLogDay);
  42. ITSLog->FLogCfg = g_LogCfg;
  43. if (!ITSDb_Initialize())
  44. {
  45. if (g_AppCfg.sLang == "kr")
  46. {
  47. Application->MessageBox(L"Database 자원을 시스템으로부터 얻지 못했습니다.\r\n\r\n프로그램을 종료합니다.",
  48. L"프로그램 시작 오류!!!",
  49. MB_OK|MB_ICONERROR);
  50. }
  51. else
  52. {
  53. Application->MessageBox(L"Database resource could not be obtained from the system.\r\n\r\nExit the program.",
  54. L"Program Start Error!!!",
  55. MB_OK|MB_ICONERROR);
  56. }
  57. goto prog_exit;
  58. }
  59. ITSDb_SetInfo(g_AppCfg.itsdb.sProvider, g_AppCfg.itsdb.sServerName, g_AppCfg.itsdb.sUserName, g_AppCfg.itsdb.sPassword);
  60. if (!ITSDb_Open())
  61. {
  62. if (g_AppCfg.sLang == "kr")
  63. {
  64. Application->MessageBox(L"데이터베이스 접속에 실패하였습니다.\r\n\r\n프로그램을 종료합니다.",
  65. L"프로그램 시작 오류!!!",
  66. MB_OK|MB_ICONERROR);
  67. }
  68. else
  69. {
  70. Application->MessageBox(L"Database connection failed.\r\n\r\nExit the program.",
  71. L"Program Start Error!!!",
  72. MB_OK|MB_ICONERROR);
  73. }
  74. goto prog_exit;
  75. }
  76. try
  77. {
  78. ReportMemoryLeaksOnShutdown = true;
  79. Application->Initialize();
  80. Application->MainFormOnTaskBar = true;
  81. Application->Title = g_AppCfg.sTitle;
  82. Application->Title = " ITS Language Resouce Editor";
  83. Application->CreateForm(__classid(TFrmLangEdit), &FrmLangEdit);
  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. ITSDb_Finalize();
  105. }
  106. catch(...)
  107. {
  108. }
  109. return 0;
  110. }
  111. //---------------------------------------------------------------------------