Exemplo n.º 1
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
	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));

	int nRet = 0;
	// BLOCK: Run application
	{
		CMainDlg dlgMain;
		nRet = dlgMain.DoModal();
	}

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 2
0
BOOL WINAPI DllMain (HINSTANCE hInst, DWORD dwReason, LPVOID lpvReserved)
{
	if(dwReason == DLL_PROCESS_ATTACH) {
		hInstance = hInst;
		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));

	#if 0
		INITCOMMONCONTROLSEX iccx;
		iccx.dwSize = sizeof(iccx);
		iccx.dwICC = ICC_BAR_CLASSES|ICC_PROGRESS_CLASS ;	// change to support other controls
		BOOL bRet = ::InitCommonControlsEx(&iccx);
		bRet;
		ATLASSERT(bRet);
	#else
		::InitCommonControls();
	#endif

		hRes = _Module.Init(NULL, hInstance);

        V2::GUI::Initialize(); // 4 gdiplus 

		ATLASSERT(SUCCEEDED(hRes));
	}	else if(dwReason == DLL_PROCESS_DETACH) {

        V2::GUI::Uninitialize(); // 4 gdiplus

		_Module.Term();
		::CoUninitialize();
	}
	return 1;
}
Exemplo n.º 3
0
/**
 * @brief Application entry point.
 * @param hInstance - Handle to the current instance of the application.
 * @param hPrevInstance - Handle to the previous instance of the application. This parameter is always NULL.
 * @param pszCmdLine - Pointer to a null-terminated string specifying the command line for the application, excluding the program name.
 * @param nCmdShow - Specifies how the window is to be shown.
 */
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, PTSTR pszCmdLine, int nCmdShow)
{
#ifdef _CRTDBG_MAP_ALLOC
	// Watch for memory leaks.
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF);
#endif

	HRESULT hRes = OleInitialize(NULL);
	ATLASSERT(SUCCEEDED(hRes));

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

	AtlInitCommonControls(ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES);	// Add flags to support other controls.

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

	int nRet = Run(pszCmdLine, nCmdShow);

	_Module.Term();
	OleUninitialize();

	return nRet;
}
Exemplo n.º 4
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
#if 0
	MessageBox(NULL, "attach debugger", "tips", IDOK);
#endif
	//Initializes the COM library on the current thread and identifies the concurrency model as single-thread apartment (STA).
	HRESULT hRes = ::CoInitialize(NULL);
	ATLASSERT(SUCCEEDED(hRes));

	// Ensures that the common control DLL (Comctl32.dll) is loaded, and registers specific common control classes from the DLL.
	// An application must call this function before creating a common control.
	AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES);

	hRes = _Module.Init(NULL, hInstance);

	int nRet = Run(lpstrCmdLine, nCmdShow);

	_Module.Term();

	//Closes the COM library on the current thread, unloads all DLLs loaded by the thread, 
	//frees any other resources that the thread maintains, and forces all RPC connections on the thread to close.
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 5
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	HRESULT hRes = ::CoInitialize(NULL);
	Gdiplus::GdiplusStartupInput gdiplusStartupInput;

	ULONG_PTR gdiplusToken;
	Gdiplus::GdiplusStartup( &gdiplusToken, &gdiplusStartupInput, 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) );
	// in WinMain
	INITCOMMONCONTROLSEX icce;
	icce.dwSize = sizeof(INITCOMMONCONTROLSEX);
	icce.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES | ICC_USEREX_CLASSES;
	InitCommonControlsEx(&icce);

	// 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) );

	int nRet = Run( lpstrCmdLine, nCmdShow );

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 6
0
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
	// init resource module
	resutils::set_handle((HMODULE)hModule);

	switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
			{
			HRESULT hRes = _Module.Init(NULL, (HINSTANCE) hModule);
			ATLASSERT(SUCCEEDED(hRes));	// Don't call important functions inside ASSERT.
			}
			break;
		case DLL_THREAD_ATTACH:
		case DLL_THREAD_DETACH:
			break;
		case DLL_PROCESS_DETACH:
			_Module.Term();
			break;
    }
    return TRUE;
}
Exemplo n.º 7
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	HRESULT hRes = CMiniPieFrame::ActivatePreviousInstance(hInstance, lpstrCmdLine);

	if(FAILED(hRes) || S_FALSE == hRes)
	{
		return hRes;
	}

	hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	AtlInitCommonControls(ICC_DATE_CLASSES);
	SHInitExtraControls();

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

	AtlAxWinInit();

	int nRet = CMiniPieFrame::AppRun(lpstrCmdLine, nCmdShow);

	AtlAxWinTerm();

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 8
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
   HRESULT hRes = ::CoInitialize(NULL);
   ATLASSERT(SUCCEEDED(hRes));

   INITCOMMONCONTROLSEX iccx;
   iccx.dwSize = sizeof(iccx);
   iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
   BOOL bRet = ::InitCommonControlsEx(&iccx);
   bRet;
   ATLASSERT(bRet);

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

   int nRet;
   {
      CMainDlg dlgMain;
      nRet = dlgMain.DoModal();
   }

   _Module.Term();
   ::CoUninitialize();

   return nRet;
}
Exemplo n.º 9
0
int WINAPI wWinMain(_In_ HINSTANCE hInstance,
	_In_opt_ HINSTANCE hPrevInstance,
	_In_ PWSTR lpCmdLine,
	_In_ int nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);
	if (!CoInitializeSingle::Initialize()){

	}
	HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
	Metro::MUI::muiController.Init();
	_Module.Init(nullptr, hInstance);
	MSG msg;
	::InitCommonControls();
	Metro::MetroWindow iMetroWindow;
	
	RECT rect = { (::GetSystemMetrics(SM_CXSCREEN) - 720) / 2, (::GetSystemMetrics(SM_CYSCREEN) - 450) / 2, (::GetSystemMetrics(SM_CXSCREEN) + 720) / 2, (::GetSystemMetrics(SM_CYSCREEN) + 450) / 2 };
	if (iMetroWindow.Create(nullptr, rect, METRO_INTERNAL_WINDOWLNAME, WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_ACCEPTFILES) == nullptr)
	{
		return -1;
	}
	DWORD dwExit = 0;
	iMetroWindow.ShowWindow(nCmdShow);
	iMetroWindow.UpdateWindow();

	while (GetMessage(&msg, nullptr, 0, 0)>0)
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	dwExit = iMetroWindow.GetExitCode();
	_Module.Term();
	return dwExit;
}
Exemplo n.º 10
0
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);
	GUID guid;
	hRes = _Module.Init(NULL,hInstance,&guid);
	ATLASSERT(SUCCEEDED(hRes));

	BkString::Load(IDR_BK_STRING_DEF);
	BkFontPool::SetDefaultFont(BkString::Get(IDS_APP_FONT), -12);
	BkSkin::LoadSkins(IDR_BK_SKIN_DEF);
	BkStyle::LoadStyles(IDR_BK_STYLE_DEF);

	CMainDlg dlgMain;
	dlgMain.DoModal();

	_Module.Term();
	::CoUninitialize();

	return 0;
}
Exemplo n.º 11
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
	HRESULT hRes = ::CoInitialize(NULL);		//初始化COM
// 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);		//全局对象_Module被初始化
	ATLASSERT(SUCCEEDED(hRes));

	BkString::Load(IDR_BK_STRING_DEF);			//加载指定资源ID的string定义xml
	BkFontPool::SetDefaultFont(BkString::Get(IDS_APP_FONT), -12);

	BkSkin::LoadSkins(IDR_BK_SKIN_DEF);			//加载指定资源ID的skin定义xml
	BkStyle::LoadStyles(IDR_BK_STYLE_DEF);		//加载指定资源ID的Style定义xml

	int nRet = 0;
	// BLOCK: Run application, 将CMainDlg变量放在一个区块中是很重要的
	{
		CMainDlg dlgMain;
		nRet = dlgMain.DoModal();
	}

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 12
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);

	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));

	int ret = Run(lpCmdLine);

	_Module.Term();
	::CoUninitialize();

	return ret;
}
Exemplo n.º 13
0
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_COOL_CLASSES | ICC_BAR_CLASSES);	// add flags to support other controls
	HINSTANCE hInstRich = ::LoadLibrary(CRichEditCtrl::GetLibraryName());

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

	AtlAxWinInit();

	int nRet = 0;
	// BLOCK: Run application
	{
		CBoggleThreadManager mgr;
		nRet = mgr.Run(lpstrCmdLine, nCmdShow);
	}

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 14
0
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;
}
Exemplo n.º 15
0
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;
}
Exemplo n.º 16
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
    initWinDbg();

#ifdef _DEBUG
#ifndef VLD
    _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
#endif

    HRESULT hRes = ::CoInitialize(NULL);
    ATLASSERT(SUCCEEDED(hRes));

    ::DefWindowProc(NULL, 0, 0, 0L);                            // this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
    AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES);	// add flags to support other controls

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

    Run(lpstrCmdLine, nCmdShow);

    _Module.Term();
    ::CoUninitialize();

    releaseWinDbg();

    return 0;
}
Exemplo n.º 17
0
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                      _In_opt_ HINSTANCE hPrevInstance,
                      _In_ LPWSTR lpCmdLine,
                      _In_ int nCmdShow)
{
	int exitCode = -1;
	HRESULT hr = ::CoInitialize(NULL);
	ATLASSERT(SUCCEEDED(hr));

	AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES);
	hr = _Module.Init(NULL, hInstance);

	CString cmdLine(lpCmdLine);
	bool isQuiet = (cmdLine.Find(L"/quiet") >= 0);

	if (!CFxHelper::IsDotNet45OrHigherInstalled()) {
		hr = CFxHelper::InstallDotNetFramework(isQuiet);
		if (hr != S_OK) {
			goto out;
		}
	}

	exitCode = CUpdateRunner::ExtractUpdaterAndRun(lpCmdLine);

out:
	_Module.Term();
	::CoUninitialize();
	return exitCode;
}
Exemplo n.º 18
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{

    HRESULT hRes = ::CoInitialize(NULL);
    ATLASSERT(SUCCEEDED(hRes));

    ::DefWindowProc(NULL, 0, 0, 0L);

    AtlInitCommonControls(ICC_BAR_CLASSES);

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

    ///> ³õʼ»¯BKWIN
    BkString::Load(IDR_BK_STRING_DEF);
    BkSkin::LoadSkins(IDR_BK_SKIN_DEF);
    BkStyle::LoadStyles(IDR_BK_STYLE_DEF);

    int nRet = Run(lpstrCmdLine, nCmdShow);

    _Module.Term();
    ::CoUninitialize();

    return nRet;
}
Exemplo n.º 19
0
int WINAPI wWinMain(_In_ HINSTANCE hInstance,
	_In_opt_ HINSTANCE hPrevInstance,
	_In_ PWSTR lpCmdLine,
	_In_ int nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);
	muiController->Init();
	_Module.Init(nullptr, hInstance);
	MSG msg;
	::InitCommonControls();
	Metro::MetroWindow iMetroWindow;
	
	RECT rect = { (::GetSystemMetrics(SM_CXSCREEN) - 720) / 2, (::GetSystemMetrics(SM_CYSCREEN) - 450) / 2, (::GetSystemMetrics(SM_CXSCREEN) + 720) / 2, (::GetSystemMetrics(SM_CYSCREEN) + 450) / 2 };
	if (iMetroWindow.Create(nullptr, rect, METRO_INTERNAL_WINDOWLNAME, WS_OVERLAPPED  | WS_CLIPSIBLINGS | WS_MINIMIZEBOX | WS_POPUP | WS_SYSMENU, WS_EX_APPWINDOW | WS_EX_WINDOWEDGE|WS_EX_ACCEPTFILES) == nullptr)
	{
		return -1;
	}
	DWORD dwExit = 0;
	iMetroWindow.ShowWindow(nCmdShow);
	iMetroWindow.UpdateWindow();

	while (GetMessage(&msg, nullptr, 0, 0)>0)
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	dwExit = iMetroWindow.GetExitCode();
	::CoUninitialize();
	_Module.Term();
	return dwExit;
}
Exemplo n.º 20
0
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));

	int nRet = 0;
	// BLOCK: Run application
	{
		CMainDlg dlgMain;
		nRet = dlgMain.DoModal();
	}

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 21
0
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));
	WSADATA wsaData;
	WSAStartup(MAKEWORD(2,2), &wsaData);
	Scintilla_RegisterClasses(hInstance);

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

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

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

	int nRet = Run(lpstrCmdLine, nCmdShow);

	_Module.Term();
	Scintilla_ReleaseResources();
	WSACleanup();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 22
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	_tsetlocale(LC_CTYPE, L""); //make CRT character handling functions handle not only C string (lower/upper case funcs)
								//maybe we need also to tell the compiler how to handle its chars (http://msdn.microsoft.com/en-us/library/3e22ty2t.aspx)

// 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_APARTMENTTHREADED); //new call
	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

	// GDI+ initialization
	ULONG_PTR gdiplusToken;
	Gdiplus::GdiplusStartupInput gdiplusStartupInput;
	Gdiplus::Status gdiPlusStatus = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
	ATLASSERT( gdiPlusStatus==Gdiplus::Ok );

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

	srand(::GetTickCount());
	int nRet = Run(lpstrCmdLine, nCmdShow);

	// GDI+ deinitialization
	GdiplusShutdown(gdiplusToken);

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 23
0
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));

#if (_WIN32_IE >= 0x0300)
	INITCOMMONCONTROLSEX iccx;
	iccx.dwSize = sizeof(iccx);
	iccx.dwICC = ICC_BAR_CLASSES;	// change to support other controls
	BOOL bRet = ::InitCommonControlsEx(&iccx);
	bRet;
	ATLASSERT(bRet);
#else
	::InitCommonControls();
#endif

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


	int nRet = Run(lpstrCmdLine, nCmdShow);

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 24
0
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));
	hRes= ::CoInitializeSecurity( NULL, //Points to security descriptor 
			-1, //Count of entries in asAuthSvc 
			NULL, //Array of names to register 
			NULL, //Reserved for future use 
			RPC_C_AUTHN_LEVEL_CONNECT, // RPC_C_AUTHN_LEVEL_NONE The default authentication //level for proxies 
			RPC_C_IMP_LEVEL_IDENTIFY, //The default impersonation //level for proxies 
			NULL, //Reserved; must be set to  NULL
			EOAC_NONE, //Additional client or //server-side capabilities 
			NULL //Reserved for future use 
			);
	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));

	int nRet = Run(lpstrCmdLine, nCmdShow);

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 25
0
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));

	g_settingsHandler.reset(new SettingsHandler());
	g_imageHandler.reset(new ImageHandler());

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

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

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

	int nRet = Run(lpstrCmdLine, nCmdShow);

	_Module.Term();
	g_settingsHandler.reset();

	::CoUninitialize();

	return nRet;
}
Exemplo n.º 26
0
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;
}
Exemplo n.º 27
0
int __stdcall _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
{
	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));

#ifdef BAZISLIB_LOCALIZATION_ENABLED
	RegistryParams params;
	params.LoadFromRegistry();
	InitializeLNGBasedTranslationEngine(params.Language);
#endif

	int nRet = AppMain();

#ifdef BAZISLIB_LOCALIZATION_ENABLED
	ShutdownTranslationEngine();
#endif

	_Module.Term();
	::CoUninitialize();
	return nRet;
}
Exemplo n.º 28
0
int WINAPI _tWinMain( HINSTANCE hInst, HINSTANCE, LPTSTR, int )
{
	_tsetlocale( LC_ALL, _T(".OCP") );

	ATLVERIFY( SUCCEEDED( _Module.Init( NULL, hInst ) ) );
	if( !EnableDebugPrivilege() )
	{
		MessageBoxV( NULL, IDS_NO_DEBUG_PRIVILEGE, MB_OK | MB_ICONHAND );
		return 0;
	}

	InitializeCriticalSection( &g_cs );
	LoadInternalExceptionList();
	LoadSettings();
	DumpInit();

	if( !ProcessCommandLine() )
	{
		AtlInitCommonControls( ICC_BAR_CLASSES );
		LoadLibrary( CRichEditCtrl::GetLibraryName() );

		CMainDlg dlgMain;
		g_pMainWnd = &dlgMain;
		int nRet = dlgMain.DoModal();
		g_pMainWnd = NULL;
	}

	DumpUninit();
	SaveSettings();
	DeleteCriticalSection( &g_cs );

	_Module.Term();
	return 0;
}
Exemplo n.º 29
0
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_COOL_CLASSES | ICC_BAR_CLASSES);	// add flags to support other controls

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

	AtlAxWinInit();

	int nRet = 0;
	
	BOOL bFirstInst = CSingleInstApp::InitInstance(APP_INST_UID);
	if (!bFirstInst) {

		if (::lstrcmpi(_T("/exit"), lpstrCmdLine) == 0) {

			CSingleInstApp::PostInstanceMesage(AIMSG_EXIT, 0);
			nRet = 251;

		} else if (::lstrcmpi(_T("/restart"), lpstrCmdLine) == 0) {

			CSingleInstApp::PostInstanceMesage(AIMSG_EXIT, 0);
			CSingleInstApp::WaitInstance(APP_INST_UID);
			nRet = Run(lpstrCmdLine, nCmdShow);
			CSingleInstApp::InitInstance(APP_INST_UID);

		} else {

			CSingleInstApp::PostInstanceMesage(AIMSG_POPUP, 0);
			nRet = 250;
		}

		//		ATOM atCmdLine = ::GlobalAddAtom(lpstrCmdLine);
		//		if (NULL != atCmdLine) {
		//		}


	} else {

		nRet = Run(lpstrCmdLine, nCmdShow);

	}

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Exemplo n.º 30
0
BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
   if( ul_reason_for_call == DLL_PROCESS_ATTACH ) _Module.Init(NULL, (HMODULE)hModule);
   if( ul_reason_for_call == DLL_PROCESS_DETACH ) _Module.Term();
   return TRUE;
}