123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include <tchar.h>
- #include <cxFormats.hpp>
- //---------------------------------------------------------------------------
- #include "AppGlobalF.h"
- #include "ITSDbF.h"
- #include "FrmVmsMsgRespMngrF.h"
- //---------------------------------------------------------------------------
- USEFORM("SRC\FrmVmsMsgRespMngrF.cpp", FrmVmsMsgRespMngr);
- //---------------------------------------------------------------------------
- WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
- {
- if (!CheckApplicationParam()) {
- return 0;
- }
- if (!ApplicationSingleRun("TFrmVmsMsgRespMngr", "VMS 대응 메시지 관리")) {
- return 0;
- }
- DateSeparator = '-';
- TimeSeparator = ':';
- ShortDateFormat ="yyyy-MM-dd";
- ShortTimeFormat = "hh:nn:ss";
- LongTimeFormat = "hh:nn:ss";
- cxFormatController()->BeginUpdate();
- cxFormatController()->UseDelphiDateTimeFormats = true;
- cxFormatController()->EndUpdate();
- cxFormatController()->GetFormats();
- cxFormatController()->NotifyListeners();
- g_nPid = (int)GetCurrentProcessId();
- g_sAppDir = ExtractFilePath(Application->ExeName);
- g_sAppName = ChangeFileExt(ExtractFileName(Application->ExeName), "");
- g_sCfgDir = g_sAppDir + g_IniFileDir + "\\";
- g_sLogDir = g_sAppDir + "Log\\";
- ForceDirectories(g_sLogDir.c_str());
- ChDir(g_sAppDir);
- /*
- * 시스템 운영환경을 ini 파일에서 읽어 온다.
- */
- LoadDefaultConfigInfo(g_IniFileName);
- ITSLog = new TITSLog(g_sLogDir, g_sAppName, g_AppCfg.sLogDay);
- ITSLog->FLogCfg = g_LogCfg;
- if (!ITSDb_Initialize())
- {
- if (g_AppCfg.sLang == "kr")
- {
- Application->MessageBox(L"Database 자원을 시스템으로부터 얻지 못했습니다.\r\n\r\n프로그램을 종료합니다.",
- L"프로그램 시작 오류!!!",
- MB_OK|MB_ICONERROR);
- }
- else
- {
- Application->MessageBox(L"Database resource could not be obtained from the system.\r\n\r\nExit the program.",
- L"Program Start Error!!!",
- MB_OK|MB_ICONERROR);
- }
- goto prog_exit;
- }
- if (g_AppCfg.itsdb.sConnectStr == "")
- {
- ITSDb_SetInfo(g_AppCfg.itsdb.sProvider, g_AppCfg.itsdb.sServerName, g_AppCfg.itsdb.sUserName, g_AppCfg.itsdb.sPassword);
- }
- else
- {
- ITSDb_SetConnStr(g_AppCfg.itsdb.sConnectStr);
- }
- if (!ITSDb_Open())
- {
- if (g_AppCfg.sLang == "kr")
- {
- Application->MessageBox(L"데이터베이스 접속에 실패하였습니다.\r\n\r\n프로그램을 종료합니다.",
- L"프로그램 시작 오류!!!",
- MB_OK|MB_ICONERROR);
- }
- else
- {
- Application->MessageBox(L"Database connection failed.\r\n\r\nExit the program.",
- L"Program Start Error!!!",
- MB_OK|MB_ICONERROR);
- }
- goto prog_exit;
- }
- try
- {
- ReportMemoryLeaksOnShutdown = true;
- Application->Initialize();
- Application->MainFormOnTaskBar = true;
- Application->Title = g_AppCfg.sTitle;
- Application->Title = "VMS 대응 메시지 관리";
- Application->CreateForm(__classid(TFrmVmsMsgRespMngr), &FrmVmsMsgRespMngr);
- Application->Run();
- }
- catch (Exception &exception)
- {
- Application->ShowException(&exception);
- }
- catch (...)
- {
- try
- {
- throw Exception("");
- }
- catch (Exception &exception)
- {
- Application->ShowException(&exception);
- }
- }
- prog_exit:
- try
- {
- ITSDb_Finalize();
- }
- catch(...)
- {
- }
-
- return 0;
- }
- //---------------------------------------------------------------------------
|