コード例 #1
0
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CMainFrame wndMain;

	CComArenaHook hook;
	//hook.open();
	//hook.demo7();
	hook.JobShopBuilder();

	if(wndMain.CreateEx() == NULL)
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	wndMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #2
0
ファイル: wtltest.cpp プロジェクト: msakuta/VastSpace
int Run(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CMainDlg dlgMain;

	if(dlgMain.Create(NULL) == NULL)
	{
		ATLTRACE(_T("Main dialog creation failed!\n"));
		return 0;
	}

	if(dlgMain.openPreview() == NULL)
	{
		ATLTRACE(_T("Preview Window creation failed!\n"));
		return 0;
	}

	dlgMain.ShowWindow(nCmdShow);

	if(lpstrCmdLine){
		char buf[256];
		wcstombs(buf, lpstrCmdLine, sizeof buf);
		dlgMain.OpenModel(buf);
	}

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #3
0
ファイル: Skin.cpp プロジェクト: xt9852/TestSet
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
    CMessageLoop theLoop;
    _Module.AddMessageLoop(&theLoop);

    CMainFrame wndMain;

    if(wndMain.CreateEx() == NULL)
    {
        ATLTRACE(_T("Main window creation failed!\n"));
        return 0;
    }

    wndMain.ShowWindow(nCmdShow);

    int nRet = theLoop.Run();

    _Module.RemoveMessageLoop();

    duWindowManager *wndManager_ = wndMain.getWindowManager();
    if (NULL != wndManager_)
    {
        ReleaseStyle(wndManager_);
    }

    return nRet;
}
コード例 #4
0
ファイル: App.cpp プロジェクト: vividos/RemotePhotoTool
int App::Run(LPCTSTR /*lpstrCmdLine*/, int nCmdShow)
{
   if (!ParseCommandLine())
      return 0;

   CMessageLoop theLoop;
   _Module.AddMessageLoop(&theLoop);

   MainFrame wndMain;

   if (!m_cszFilename.IsEmpty())
      wndMain.OpenFileAtStart(m_cszFilename);

   if (wndMain.CreateEx() == nullptr)
   {
      ATLTRACE(_T("Main window creation failed!\n"));
      return 0;
   }

   wndMain.ShowWindow(nCmdShow);

   int nRet = theLoop.Run();

   _Module.RemoveMessageLoop();
   return nRet;
}
コード例 #5
0
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
    // For logging; redirects output so that it works with the allocated console
    if (::AllocConsole()) {
        ::freopen("CONOUT$", "w", stdout);
        auto h = ::GetStdHandle(STD_OUTPUT_HANDLE);
        // For nowide; output is not displayed otherwise
        nowide::cout.set_rdbuf(new nowide::details::my_console_output_buffer(h));
    }

    bool shouldBeVerbose = true;
    if (shouldBeVerbose) {
        using namespace vanhelsing::engine;
        Log::SetLogLevelFilter(LogLevel::Trace);
    }

	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CMainDlg dlgMain;

	if(dlgMain.Create(NULL) == NULL)
	{
		ATLTRACE(_T("Main dialog creation failed!\n"));
		return 0;
	}

	dlgMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #6
0
ファイル: dllmain.cpp プロジェクト: fanliaokeji/lvdun
extern "C" __declspec(dllexport) void LoadLuaRunTime(char* szInstallDir)
{
	TSTRACEAUTO();
	HRESULT hr = ::CoInitialize(NULL);
	hr = _Module.Init(NULL, gInstance);


	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CLRTAgent lrtAgent;
	//lrtAgent.InitLua(szInstallDir);
	//g_hXappLuaToolDll = lrtAgent.GetXappLuaToolDllModuleHandle();
	if (lrtAgent.InitLua(szInstallDir))
	{
		TSDEBUG4CXX(_T(">>>>>theLoop.Run()"));
		theLoop.Run();
		TSDEBUG4CXX(_T("<<<<<theLoop.Run()"));
	}
	_Module.RemoveMessageLoop();
	_Module.Term();
	::CoUninitialize();
	TerminateProcess(::GetCurrentProcess(), S_OK);

	return;
}
コード例 #7
0
ファイル: CrashSender.cpp プロジェクト: doo/CrashRpt
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int /*nCmdShow*/ = SW_SHOWDEFAULT)
{
  // Check window mirroring settings 
  CString sRTL = Utility::GetINIString(_T("Settings"), _T("RTLReading"));
  if(sRTL.CompareNoCase(_T("1"))==0)
  {
  	SetProcessDefaultLayout(LAYOUT_RTL);  
  }  

  CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);
  
  int nGetCrashInfoThroughPipe = GetCrashInfoThroughPipe();
  if(nGetCrashInfoThroughPipe!=0)
  {
    ATLASSERT(nGetCrashInfoThroughPipe==0);
    return 1; 
  }
    
	if(dlgMain.Create(NULL) == NULL)
	{
		ATLTRACE(_T("Main dialog creation failed!\n"));
		return 0;
	}
  
	//dlgMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #8
0
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	int nRet = 0;
	FUNCTION_BLOCK_INIT();
	{
		FUNCTION_BLOCK_TRACE(0);

		CMessageLoop theLoop;
		_Module.AddMessageLoop(&theLoop);

		CMainFrame wndMain;

		if(wndMain.CreateEx() == NULL)
		{
			ATLTRACE(_T("Main window creation failed!\n"));
			return 0;
		}

		wndMain.ShowWindow(nCmdShow);

		nRet = theLoop.Run();

		_Module.RemoveMessageLoop();
	}
	FUNCTION_BLOCK_UNINIT();
	return nRet;
}
コード例 #9
0
ファイル: ImageLayers.cpp プロジェクト: kkfnui/Experiments
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
	HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to 
// make the EXE free threaded. This means that calls come in on a random RPC thread.
//	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
	//::DefWindowProc(NULL, 0, 0, 0L);

	AtlInitCommonControls(ICC_BAR_CLASSES);	// add flags to support other controls

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	CMessageLoop theLoop;
	CMessageFilter * filter = new CMouseWheelFilter();
	theLoop.AddMessageFilter(filter);
	_Module.AddMessageLoop(&theLoop);

	
	CMainDlg dlgMain;
	dlgMain.Create(NULL);
	dlgMain.ShowWindow(SW_NORMAL);
	int nRet = theLoop.Run();
	delete filter;
	_Module.RemoveMessageLoop();
	//_Module.Term();
	::CoUninitialize();

	return nRet;
}
コード例 #10
0
ファイル: assist.cpp プロジェクト: mosunovpa/Projects
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); // report memory leaks

    CMessageLoop theLoop;
    _Module.AddMessageLoop(&theLoop);

    try
    {
        CModuleLoader::Get().LoadModules();
        try
        {
            CApplicationImpl::Get().OpenLastDataFile();
        }
        catch(...)
        {
            return 0;
        }

        // Create a hidden window
        if (!CApplicationImpl::Get().CreateAppWindow())
            return 0;

        int nRet = theLoop.Run();

        _Module.RemoveMessageLoop();
        return nRet;
    }
    CATCH_ALL_ERRORS(NULL)

    return 0;
}
コード例 #11
0
ファイル: main.cpp プロジェクト: YDS19872712/Notepad--
int __stdcall WinMain(HINSTANCE hinst, HINSTANCE, PSTR cmdLine, int cmdShow)
{
    _Module.Init(0, hinst, 0);

    CMessageLoop msgLoop;
    _Module.AddMessageLoop(&msgLoop);

    int result = -1;

    CMainFrame frame;

    frame.Create(
        ::GetDesktopWindow(),
        CWindow::rcDefault,
        TEXT("Notepad--"));

    if (frame.IsWindow()) {
        frame.ShowWindow(cmdShow);
        result = msgLoop.Run();
    }

    _Module.RemoveMessageLoop();
    _Module.Term();

    return result;
}
コード例 #12
0
ファイル: WTLDemo.cpp プロジェクト: ELMERzark/crashrpt
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
    CMessageLoop theLoop;
    _Module.AddMessageLoop(&theLoop);

    // Get command line params
    LPCWSTR szCommandLine = GetCommandLineW();  
    int argc = 0;
    LPWSTR* argv = CommandLineToArgvW(szCommandLine, &argc);

    CMainDlg dlgMain;

    if(argc==2 && wcscmp(argv[1], L"/restart")==0)
        dlgMain.m_bRestarted = TRUE;
    else
        dlgMain.m_bRestarted = FALSE;

    if(dlgMain.Create(NULL) == NULL)
    {
        ATLTRACE(_T("Main dialog creation failed!\n"));
        return 0;
    }

    dlgMain.ShowWindow(nCmdShow);

    int nRet = theLoop.Run();

    _Module.RemoveMessageLoop();
    return nRet;
}
コード例 #13
0
ファイル: CrashSender.cpp プロジェクト: doo/CrashRpt
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

  CMainDlg dlgMain;

  if(GetCrashInfoThroughPipe(
    dlgMain.m_sAppName,
    dlgMain.m_sImageName,
    dlgMain.m_sEmailSubject, 
    dlgMain.m_sEmailTo, 
    dlgMain.m_sUrl,
    &dlgMain.m_uPriorities,
    dlgMain.m_sZipName,    
    dlgMain.m_pUDFiles)!=0)
    return 1; 
  
	if(dlgMain.Create(NULL) == NULL)
	{
		ATLTRACE(_T("Main dialog creation failed!\n"));
		return 0;
	}

	dlgMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #14
0
ファイル: mudclient.cpp プロジェクト: carriercomm/tortilla
int Run(LPTSTR /*lpstrCmdLine*/, int nCmdShow = SW_SHOWDEFAULT)
{
    NetworkInit n;
    if (!n.init())
    {
        msgBox(NULL, IDS_ERROR_INIT_NETWORK, MB_OK|MB_ICONERROR);
        return 0;
    }

#ifndef _DEBUG  // для запуска новых копий клиента из панели задач
    {
        DWORD a = GetFileAttributes(L"gamedata");
        if (a == INVALID_FILE_ATTRIBUTES || !(a&FILE_ATTRIBUTE_DIRECTORY))
        {
            WCHAR path[MAX_PATH+1];
            GetModuleFileName(NULL, path, MAX_PATH);
            WCHAR *p = wcsrchr(path, L'\\');
            int len = p-path+1;
            std::wstring new_cdir(path, len);
            SetCurrentDirectory(new_cdir.c_str());
        }
    }
#endif

	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	if(_wndMain.CreateEx() == NULL)
		return 0;

	int nRet = theLoop.Run();
	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #15
0
ファイル: BmpView.cpp プロジェクト: Nuos/codeproject
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = 
#ifndef _WIN32_WCE
		SW_SHOWDEFAULT
#else // _WIN32_WCE
		SW_SHOWNORMAL
#endif // _WIN32_WCE
		)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CMainFrame wndMain;

	if(wndMain.CreateEx() == NULL)
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	wndMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #16
0
ファイル: Molecules.cpp プロジェクト: ebutusov/Molecules
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	// set normal priority
	DWORD pid = ::GetCurrentProcessId();
	HANDLE hProc = ::OpenProcess(PROCESS_SET_INFORMATION, TRUE, pid);
	::SetPriorityClass(hProc, NORMAL_PRIORITY_CLASS);
	::CloseHandle(hProc);
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CSaverWindow wndMain;
	if(wndMain.Create(NULL, true) == NULL)
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	wndMain.ShowWindow(SW_SHOW);
	Sleep(10);
	wndMain.RunSaver();

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #17
0
ファイル: Molecules.cpp プロジェクト: ebutusov/Molecules
int Settings(HWND hwndParent)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CSettingsSheet dlg;
	int nRet = 0;

	if(hwndParent) 
		dlg.DoModal(hwndParent);
	else
	{
		if(dlg.Create(NULL) == NULL)
		{
				ATLTRACE(_T("Settings dialog creation failed!\n"));
				return 0;
		}
		_Module.Lock();
		dlg.ShowWindow(SW_SHOW);
		Sleep(10);
		nRet = theLoop.Run();
		_Module.RemoveMessageLoop();
	}
  return nRet;
}
コード例 #18
0
ファイル: Kolumnz.cpp プロジェクト: steelwil/Kolumnz
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CMainFrame wndMain;

	if(wndMain.CreateEx() == NULL)
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	if (wndMain.m_wp.showCmd == SW_MAXIMIZE)
		nCmdShow = SW_MAXIMIZE;
	if (wndMain.m_wp.rcNormalPosition.right > 0 &&
		wndMain.m_wp.rcNormalPosition.bottom > 0 &&
		wndMain.m_wp.rcNormalPosition.top < wndMain.m_wp.rcNormalPosition.bottom && 
		wndMain.m_wp.rcNormalPosition.left < wndMain.m_wp.rcNormalPosition.right)
		wndMain.MoveWindow(	
			wndMain.m_wp.rcNormalPosition.left, 
			wndMain.m_wp.rcNormalPosition.top, 
			wndMain.m_wp.rcNormalPosition.right-wndMain.m_wp.rcNormalPosition.left, 
			wndMain.m_wp.rcNormalPosition.bottom-wndMain.m_wp.rcNormalPosition.top, FALSE); 
	wndMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #19
0
ファイル: main.cpp プロジェクト: JohannesHei/Scylla
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	CoInitialize(NULL);
	SetUnhandledExceptionFilter(HandleUnknownException);

	AtlInitCommonControls(ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES);

	HRESULT hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	int nRet = 0;
	// BLOCK: Run application
	{
		MainGui dlgMain;
		pMainGui = &dlgMain; // o_O

		CMessageLoop loop;
		_Module.AddMessageLoop(&loop);

		dlgMain.Create(GetDesktopWindow());
		dlgMain.ShowWindow(SW_SHOW);

		loop.Run();
	}

	_Module.Term();
	CoUninitialize();

	return nRet;
}
コード例 #20
0
ファイル: Webpdf.cpp プロジェクト: midiway/WebPDF
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	if( !RunTimeHelper::IsVista() )
	{
		AtlMessageBox(NULL, L"Windows Vista or greater is required to run this program.");
		return 0;
	}

	CDwm dwm;
	cIsComposited = dwm.DwmIsCompositionEnabled()!=FALSE;

	
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	int basex = 314;//320
	int basey = 290;//285

	CMainFrame frame;
	if( frame.CreateEx(0, CRect(0, 0, basex, basey))==NULL )
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	_wndMain = frame;
	_wndMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #21
0
ファイル: Kui_demo.cpp プロジェクト: charlessoft/kui_demo
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	BkString::Load(IDR_STRING_DEF); // ╪стьвж╥Ш╢╝
	BkSkin::LoadSkins(IDR_SKIN_DEF); // ╪стьф╓╥Т
	BkStyle::LoadStyles(IDR_STYLE_DEF); // ╪сть╥Г╦Я

	CMainDlg dlgMain;

	if(dlgMain.Create(NULL) == NULL)
	{
		DWORD dwErr = GetLastError();
		ATLTRACE(_T("Main dialog creation failed!\n"));
		return 0;
	}
 
	dlgMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #22
0
ファイル: Proxydomo.cpp プロジェクト: lltcggie/Proxydomo
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CProxy	proxy;
	proxy.OpenProxyPort(CSettings::s_proxyPort);

	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	CMainDlg dlgMain(&proxy);

	if(dlgMain.Create(NULL) == NULL)
	{
		ATLTRACE(_T("Main dialog creation failed!\n"));
		return 0;
	}

	//dlgMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();

	proxy.CloseProxyPort();
	return nRet;
}
コード例 #23
0
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	g_hMenuGroup = LoadMenu( _Module.GetResourceInstance(), MAKEINTRESOURCE( IDR_MENU_GROUP ) );
	g_hMenuGroup = GetSubMenu( g_hMenuGroup, 0 );
	g_hMenuColor = LoadMenu( _Module.GetResourceInstance(), MAKEINTRESOURCE( IDR_MENU_COLOR ) );
	g_hMenuColor = GetSubMenu( g_hMenuColor, 0 );

	CMainWnd wndMain;
	char szTitle[256] = { 0 };
	sprintf( szTitle, "%s %s", GetAppName(), GetAppVer() );
	if( NULL == wndMain.Create( NULL, CWindow::rcDefault, szTitle, WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX ) )
	{
		ATLTRACE( _T("Main window creation failed!\n") );
		return( 0 );
	}
	wndMain.ShowWindow( nCmdShow );

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #24
0
ファイル: Wizard.cpp プロジェクト: fanliaokeji/lvdun
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #25
0
ファイル: uugarden_net.cpp プロジェクト: henrywoo/ultraie
int Run(LPTSTR lpstrCmdLine=NULL, int nCmdShow=SW_SHOWDEFAULT){
  CMessageLoop theLoop;
  _Module.AddMessageLoop(&theLoop);
  CMainDlg dlgMain;
  if(dlgMain.Create(NULL) == NULL){
    return 0;
  }
  dlgMain.ShowWindow(nCmdShow);
  int nRet = theLoop.Run();
  _Module.RemoveMessageLoop();
  return nRet;
}
コード例 #26
0
ファイル: Main.cpp プロジェクト: ARAGORN89/DarunGrim
int Run(LPTSTR lpstrCmdLine=NULL,int nCmdShow=SW_SHOWDEFAULT)
{
	char *Filename=NULL;

	int    argc;
	WCHAR  *wcCommandLine;
	LPWSTR *argw;
	
	wcCommandLine=GetCommandLineW();	
	argw=CommandLineToArgvW(wcCommandLine,&argc);

	if(argw && argc>1)
	{
		int BuffSize=WideCharToMultiByte(CP_ACP,WC_COMPOSITECHECK,argw[1],-1,NULL,0,NULL,NULL);
		if(BuffSize>0)
		{
			Filename=(char *)GlobalAlloc(LPTR,BuffSize);
			if(Filename)
				WideCharToMultiByte(CP_ACP,WC_COMPOSITECHECK,argw[1],BuffSize*sizeof(WCHAR),Filename,BuffSize,NULL,NULL);
		}
	}

	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);
	CMainFrame wndMain;
	//size of window to create
	CRect rc=CRect(0,0,800,600);
	if(wndMain.CreateEx(NULL,rc) == NULL)
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	//center and show main window
	wndMain.CenterWindow();
	wndMain.ShowWindow(nCmdShow);
	new CSplashWnd(IDB_SPLASH,3000,wndMain.m_hWnd);
	if(Filename)
		wndMain.SetDatabaseFilename(Filename);

	try
	{
		int nRet = theLoop.Run();
		_Module.RemoveMessageLoop();
		return nRet;
	}
	catch (...)
	{
		return false;
	}
}
コード例 #27
0
int Run(bool bAutomation, LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CComObject<CPageDesignerApp>* app;
	CComObject<CPageDesignerApp>::CreateInstance(&app);
	app->AddRef();
	gApp = app;
	gIApp = app;

	int nRet;

	if (bAutomation)
	{
		CMessageLoop theLoop;
		_Module.AddMessageLoop(&theLoop);	// ??

		nRet = theLoop.Run();

		_Module.RemoveMessageLoop();	// ??
	}
	else
	{
		CMessageLoop theLoop;
		_Module.AddMessageLoop(&theLoop);

		long result;
		app->Run(&result);

		_Module.Lock();

		nRet = theLoop.Run();

		_Module.RemoveMessageLoop();
	}

	app->Release();

	return nRet;
}
コード例 #28
0
int Run(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	HRESULT hr = S_FALSE;
	BOOL fSuccess = FALSE;

	fSuccess = InitSystemCfg();
	if (!fSuccess) {
		pAppInitErrMessage(IDS_APP_INIT_ERROR_OUT_OF_MEMORY);
		return ::GetLastError();
	}

	fSuccess = InitUserCfg();
	if (!fSuccess) {
		pAppInitErrMessage(IDS_APP_INIT_ERROR_OUT_OF_MEMORY);
		return ::GetLastError();
	}

	// command line override the registry settings
	LANGID wPrefLangID = pGetPreferredLangID(lpstrCmdLine);
	fSuccess = pLoadResourceModule(wPrefLangID);
	if (!fSuccess) {
		return 255;
	}

	// not need to initialize each time.
	fSuccess = NdasCommInitialize();
	if (!fSuccess) {
		return 254;
	}



	CMainFrame wndMain;

	if(wndMain.CreateEx() == NULL)
	{
		ATLTRACE(_T("Main window creation failed!\n"));
		return 0;
	}

	wndMain.ShowWindow(nCmdShow);

	int nRet = theLoop.Run();

	_Module.RemoveMessageLoop();
	return nRet;
}
コード例 #29
0
ファイル: NotifierHost.cpp プロジェクト: ip821/BaseNotifier
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	int nRet = 0;
	{
		CAppSingleInstance m_appSingleInstance;
		if(m_appSingleInstance.IsAnotherInstanceRunning())
		{
			CString msgAlreadyRunning;
			msgAlreadyRunning.LoadString(IDS_ALREADYRUNNING);
			CString strCaption;
			strCaption.LoadString(IDS_CAPTION);
			MessageBox(NULL, msgAlreadyRunning, strCaption, 0);
			return 1;
		}

		CMessageLoop theLoop;
		_Module.AddMessageLoop(&theLoop);

		SetCurrentDirectoryToApplicationRoot();
		g_hObjMdl = LoadLibrary(L"objmdl.dll");
		GetPluginManager()->InitializePluginLibraryByHandle(g_hObjMdl);
		GetPluginManager()->InitializePluginLibraryByName(L"viewmdl.dll");
		GetPluginManager()->InitializePluginLibraryByName(L"asyncsvc.dll");
		GetPluginManager()->LoadPlugins(NULL);

		CComObject<CMainDlg>* pMainDlg;
		CComObject<CMainDlg>::CreateInstance(&pMainDlg);
		HWND hWnd = 0;

		if (FAILED(pMainDlg->CreateEx(NULL, &hWnd)))
		{
			ATLTRACE(_T("Main dialog creation failed!\n"));
			return 0;
		}

		::ShowWindow(hWnd, SW_HIDE);

		nRet = theLoop.Run();

		_Module.RemoveMessageLoop();
	}

#ifdef _DEBUG
	_CrtDumpMemoryLeaks();
#endif

	return nRet;
}
コード例 #30
0
ファイル: iexplore.cpp プロジェクト: yuanbaoyuele/yuanbaoyule
int Run(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
	CMessageLoop theLoop;
	_Module.AddMessageLoop(&theLoop);

	int nRet = 0;
	CYBPretender ybPretender;
	if (ybPretender.Init(lpstrCmdLine))
	{
		nRet = theLoop.Run();
	}
	// 消息循环不应该结束,结束就是走了非正常流程。。。直接杀了
	TerminateProcess(GetCurrentProcess(),(UINT)-16);
	_Module.RemoveMessageLoop();
	return nRet;
}