123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include <tchar.h>
- #include <cxFormats.hpp>
- //---------------------------------------------------------------------------
- #include "AppGlobalF.h"
- #include "FrmCmraViewerMainF.h"
- //---------------------------------------------------------------------------
- USEFORM("SRC\FrmCameraInfoF.cpp", FrmCameraInfo);
- USEFORM("SRC\FrmCameraPlayerF.cpp", FrmCameraPlayer);
- USEFORM("SRC\FrmCameraScreenF.cpp", FrmCameraScreen);
- USEFORM("SRC\FrmCameraFullScreenF.cpp", FrmCameraFullScreen);
- USEFORM("SRC\FrmMonitoringEditF.cpp", FrmMonitoringEdit);
- USEFORM("LIB\ITSLog\FrmSqlErrorF.cpp", FrmSqlError);
- USEFORM("SRC\DMDbF.cpp", DMDb); /* TDataModule: File Type */
- USEFORM("SRC\FrmCmraViewerMainF.cpp", FrmCmraViewerMain);
- //---------------------------------------------------------------------------
- WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
- {
- #if 0
- if (!CheckApplicationParam()) {
- return 0;
- }
- if (!ApplicationSingleRun("TFrmCmraViewerMain", "영상 모니터링")) {
- return 0;
- }
- #endif
- 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();
- String sLoginId = "ADMIN";
- bool bLogin = true;
- int nArgs = ParamCount();
- if (nArgs >= 1)
- {
- sLoginId = ParamStr(1);
- bLogin = false;
- }
- g_nPid = (int)GetCurrentProcessId();
- g_sAppDir = ExtractFilePath(Application->ExeName);
- g_sAppName = ChangeFileExt(ExtractFileName(Application->ExeName), "");
- g_sCfgDir = g_sAppDir + "Cfg\\";
- //g_sCfgDir = g_sAppDir + g_IniFileDir + "\\";
- g_sLangDir = g_sAppDir + "Lang\\";
- g_sLogDir = g_sAppDir + "Log\\";
- ForceDirectories(g_sLogDir.c_str());
- ChDir(g_sAppDir);
- /*
- * 시스템 운영환경을 ini 파일에서 읽어 온다.
- */
- LoadDefaultConfigInfo("ITS_OP");
- HANDLE hMutex;
- try
- {
- String sLockFile = ChangeFileExt(ExtractFileName(Application->ExeName), ".lock");
- String sProgMutexNm = "HANTE_" + sLockFile;
- if ((hMutex=OpenMutex(MUTEX_ALL_ACCESS, false, sProgMutexNm.c_str()))==NULL)
- hMutex = CreateMutex(NULL, true, sProgMutexNm.c_str());
- else
- {
- if (g_sLang == "kr")
- {
- Application->MessageBox(L"영상뷰어 프로그램이 이미 실행중입니다.\r\n작업관리자의 프로세스 목록에서 프로그램을 종료후 실행해 주십시오.",
- L"프로그램 시작 오류!!!",
- MB_OK|MB_ICONERROR);
- }
- else
- {
- Application->MessageBox(L"The operating terminal program is already running.\r\nPlease exit the program from the process list of Task Manager and execute it.",
- L"Program Start Error!!!",
- MB_OK|MB_ICONERROR);
- }
- return 0;
- }
- }
- catch (Exception &exception)
- {
- Application->ShowException(&exception);
- return 0;
- }
- #if 0
- g_sLangDir = g_sLangDir + g_AppCfg.sLang + "\\";
- ForceDirectories(g_sLangDir.c_str());
- LangTrans = new TLangTrans("CctvCamViewer", g_AppCfg.sLang, g_sLangDir, true);
- #endif
- ITSLog = new TITSLog(g_sLogDir, g_sAppName, g_AppCfg.sLogDay);
- ITSLog->FLogCfg = g_LogCfg;
- try
- {
- ReportMemoryLeaksOnShutdown = true;
- Application->Initialize();
- Application->MainFormOnTaskBar = true;
- Application->Title = g_AppCfg.sTitle;
- Application->Title = "CCTV 영상 모니터링";
- Application->CreateForm(__classid(TFrmCmraViewerMain), &FrmCmraViewerMain);
- Application->CreateForm(__classid(TDMDb), &DMDb);
- Application->Run();
- }
- catch (Exception &exception)
- {
- Application->ShowException(&exception);
- }
- catch (...)
- {
- try
- {
- throw Exception("");
- }
- catch (Exception &exception)
- {
- Application->ShowException(&exception);
- }
- }
- prog_exit:
- try
- {
- ReleaseMutex(hMutex);
- CloseHandle(hMutex);
- hMutex = NULL;
- }
- catch(...)
- {
- }
-
- return 0;
- }
- //---------------------------------------------------------------------------
|