2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
22 #include "Application.h"
\r
23 #include "utils\FileOutputStream.h"
\r
24 #include <tbb/task_scheduler_init.h>
\r
26 //the easy way to make it possible to forward WndProc messages into the application-object
\r
27 caspar::Application* pGlobal_Application = 0;
\r
30 Application* GetApplication()
\r
32 return pGlobal_Application;
\r
36 int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int)
\r
38 int returnValue = 0;
\r
39 tstring commandline(lpCmdLine);
\r
41 tbb::task_scheduler_init task_scheduler(max(2, tbb::task_scheduler_init::default_num_threads()));
\r
43 //if(commandline == TEXT("install"))
\r
45 // caspar::Application::InstallService();
\r
47 //else if(commandline == TEXT("uninstall"))
\r
49 // caspar::Application::UninstallService();
\r
54 caspar::utils::OutputStreamPtr pOutputStream(new caspar::utils::FileOutputStream(TEXT("startup.log")));
\r
55 caspar::utils::Logger::GetInstance().SetOutputStream(pOutputStream);
\r
56 caspar::utils::Logger::GetInstance().SetTimestamp(true);
\r
58 caspar::Application app(lpCmdLine, hInstance);
\r
59 pGlobal_Application = &app;
\r
61 //if(commandline.find(TEXT("service")) != tstring::npos)
\r
62 // app.RunAsService();
\r
64 returnValue = app.RunAsWindow();
\r
66 catch(const std::exception& ex)
\r
68 LOG << caspar::utils::LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in main thread. Message: ") << ex.what();
\r