| 1 | //////////////////////////////////////////////////////////// |
|---|
| 2 | // FileMappingVirtualAddress.cpp |
|---|
| 3 | // |
|---|
| 4 | // Created by Roman Ryltsov roman@alax.info |
|---|
| 5 | // |
|---|
| 6 | // $Id$ |
|---|
| 7 | |
|---|
| 8 | #include "stdafx.h" |
|---|
| 9 | #include "resource.h" |
|---|
| 10 | #include "initguid.h" |
|---|
| 11 | #include "MainDialog.h" |
|---|
| 12 | |
|---|
| 13 | //////////////////////////////////////////////////////////// |
|---|
| 14 | // CFileMappingVirtualAddressModule |
|---|
| 15 | |
|---|
| 16 | [ |
|---|
| 17 | module( |
|---|
| 18 | type = exe, |
|---|
| 19 | name = "FileMappingVirtualAddres", |
|---|
| 20 | uuid = "D03F9EC8-7A19-45F9-BB0F-73A25A04B311" |
|---|
| 21 | ) |
|---|
| 22 | ] |
|---|
| 23 | class CFileMappingVirtualAddressModule : |
|---|
| 24 | //public CAtlExeModuleT<CFileMappingVirtualAddressModule>, |
|---|
| 25 | public CWtlExeModuleT<CFileMappingVirtualAddressModule> |
|---|
| 26 | { |
|---|
| 27 | typedef CWtlExeModuleT<CFileMappingVirtualAddressModule> CWtlExeModule; |
|---|
| 28 | |
|---|
| 29 | public: |
|---|
| 30 | // CFileMappingVirtualAddressModule |
|---|
| 31 | |
|---|
| 32 | // CAtlExeModuleT |
|---|
| 33 | CFileMappingVirtualAddressModule() throw() |
|---|
| 34 | { |
|---|
| 35 | #if _DEVELOPMENT |
|---|
| 36 | AtlTraceLoadSettings(NULL); |
|---|
| 37 | #endif // _DEVELOPMENT |
|---|
| 38 | _W(CExceptionFilter::Initialize()); |
|---|
| 39 | _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
|---|
| 40 | } |
|---|
| 41 | ~CFileMappingVirtualAddressModule() throw() |
|---|
| 42 | { |
|---|
| 43 | _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
|---|
| 44 | CExceptionFilter::Terminate(); |
|---|
| 45 | } |
|---|
| 46 | HRESULT PreMessageLoop(INT nShowCommand) throw() |
|---|
| 47 | { |
|---|
| 48 | _ATLTRY |
|---|
| 49 | { |
|---|
| 50 | __E(AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_COOL_CLASSES)); |
|---|
| 51 | //__C(CWtlExeModule::Initialize()); |
|---|
| 52 | __C(__super::PreMessageLoop(nShowCommand)); |
|---|
| 53 | } |
|---|
| 54 | _ATLCATCH(Exception) |
|---|
| 55 | { |
|---|
| 56 | _C(Exception); |
|---|
| 57 | } |
|---|
| 58 | return S_OK; |
|---|
| 59 | } |
|---|
| 60 | VOID RunMessageLoop() throw() |
|---|
| 61 | { |
|---|
| 62 | _W(AtlInitCommonControls(ICC_WIN95_CLASSES)); |
|---|
| 63 | Lock(); |
|---|
| 64 | { |
|---|
| 65 | CMainDialog MainDialog; |
|---|
| 66 | MainDialog.DoModal(); |
|---|
| 67 | } |
|---|
| 68 | if(GetLockCount() == 1) |
|---|
| 69 | { |
|---|
| 70 | m_dwTimeOut = 0; |
|---|
| 71 | m_dwPause = 0; |
|---|
| 72 | } |
|---|
| 73 | Unlock(); |
|---|
| 74 | } |
|---|
| 75 | HRESULT PostMessageLoop() throw() |
|---|
| 76 | { |
|---|
| 77 | _ATLTRY |
|---|
| 78 | { |
|---|
| 79 | _V(__super::PostMessageLoop()); |
|---|
| 80 | //CWtlExeModule::Terminate(); |
|---|
| 81 | } |
|---|
| 82 | _ATLCATCH(Exception) |
|---|
| 83 | { |
|---|
| 84 | _C(Exception); |
|---|
| 85 | } |
|---|
| 86 | return S_OK; |
|---|
| 87 | } |
|---|
| 88 | }; |
|---|