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