Use Slim Reader/Writer lock to replace CRITICAL_SECTION (better performance).
[gdipp.git] / gdipp_demo / gdipp_demo.cpp
blob89cfdfd1613d92d144e06c7628edb44ff8bc69e9
1 // gdipp_demo.cpp : main source file for gdipp_demo.exe
2 //
4 #include "stdafx.h"
5 #include "gdipp_demo/resource.h"
6 #include "gdipp_demo/MainDlg.h"
8 CAppModule _Module;
10 int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
12 CMessageLoop theLoop;
13 _Module.AddMessageLoop(&theLoop);
15 CMainDlg dlgMain;
17 if(dlgMain.Create(NULL) == NULL)
19 ATLTRACE(_T("Main dialog creation failed!\n"));
20 return 0;
23 dlgMain.ShowWindow(nCmdShow);
25 int nRet = theLoop.Run();
27 _Module.RemoveMessageLoop();
28 return nRet;
31 int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
33 // If you are running on NT 4.0 or higher you can use the following call instead to
34 // make the EXE free threaded. This means that calls come in on a random RPC thread.
35 HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
36 ATLASSERT(SUCCEEDED(hRes));
38 // this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
39 ::DefWindowProc(NULL, 0, 0, 0L);
41 AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
43 hRes = _Module.Init(NULL, hInstance);
44 ATLASSERT(SUCCEEDED(hRes));
46 int nRet = Run(lpstrCmdLine, nCmdShow);
48 _Module.Term();
49 ::CoUninitialize();
51 return nRet;