1 | //////////////////////////////////////////////////////////// |
---|
2 | // Copyright (C) Roman Ryltsov, 2012 |
---|
3 | // Created by Roman Ryltsov roman@alax.info |
---|
4 | // |
---|
5 | // $Id: CaptureClock.cpp 102 2012-08-26 12:54:40Z roman $ |
---|
6 | |
---|
7 | #include "stdafx.h" |
---|
8 | #include "resource.h" |
---|
9 | #include "CaptureClock_i.h" |
---|
10 | #include "MainDialog.h" |
---|
11 | |
---|
12 | //////////////////////////////////////////////////////////// |
---|
13 | // CCaptureClockModule |
---|
14 | |
---|
15 | class CCaptureClockModule : |
---|
16 | public CAtlExeModuleT<CCaptureClockModule>, |
---|
17 | public CWtlExeModuleT<CCaptureClockModule> |
---|
18 | { |
---|
19 | public: |
---|
20 | |
---|
21 | //DECLARE_LIBID(LIBID_AlaxInfoCaptureClock) |
---|
22 | |
---|
23 | //DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MODULE, "{...}") |
---|
24 | |
---|
25 | public: |
---|
26 | // CCaptureClockModule |
---|
27 | CCaptureClockModule() throw() |
---|
28 | { |
---|
29 | AtlTraceSetDefaultSettings(); |
---|
30 | _W(CExceptionFilter::Initialize()); |
---|
31 | _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
---|
32 | } |
---|
33 | ~CCaptureClockModule() throw() |
---|
34 | { |
---|
35 | _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
---|
36 | CExceptionFilter::Terminate(); |
---|
37 | } |
---|
38 | HRESULT PreMessageLoop(INT nShowCommand) throw() |
---|
39 | { |
---|
40 | _ATLTRY |
---|
41 | { |
---|
42 | TraceModuleVersion(); |
---|
43 | __E(AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_COOL_CLASSES)); |
---|
44 | //__C(CWtlExeModule::Initialize()); |
---|
45 | __C(__super::PreMessageLoop(nShowCommand)); |
---|
46 | } |
---|
47 | _ATLCATCH(Exception) |
---|
48 | { |
---|
49 | _C(Exception); |
---|
50 | } |
---|
51 | return S_OK; |
---|
52 | } |
---|
53 | VOID RunMessageLoop() throw() |
---|
54 | { |
---|
55 | Lock(); |
---|
56 | { |
---|
57 | CMainDialog MainDialog; |
---|
58 | MainDialog.DoModal(); |
---|
59 | } |
---|
60 | if(GetLockCount() == 1) |
---|
61 | { |
---|
62 | m_dwTimeOut = 0L; |
---|
63 | m_dwPause = 0L; |
---|
64 | } |
---|
65 | Unlock(); |
---|
66 | } |
---|
67 | HRESULT PostMessageLoop() throw() |
---|
68 | { |
---|
69 | _ATLTRY |
---|
70 | { |
---|
71 | _V(__super::PostMessageLoop()); |
---|
72 | //CWtlExeModule::Terminate(); |
---|
73 | } |
---|
74 | _ATLCATCH(Exception) |
---|
75 | { |
---|
76 | _C(Exception); |
---|
77 | } |
---|
78 | return S_OK; |
---|
79 | } |
---|
80 | }; |
---|
81 | |
---|
82 | CCaptureClockModule _AtlModule; |
---|
83 | |
---|
84 | //////////////////////////////////////////////////////////// |
---|
85 | // Main |
---|
86 | |
---|
87 | extern "C" int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, INT nShowCommand) |
---|
88 | { |
---|
89 | return _AtlModule.WinMain(nShowCommand); |
---|
90 | } |
---|
91 | |
---|