1 | //////////////////////////////////////////////////////////// |
---|
2 | // Copyright (C) Roman Ryltsov, 2008-2014 |
---|
3 | // Created by Roman Ryltsov roman@alax.info |
---|
4 | |
---|
5 | #include "stdafx.h" |
---|
6 | #include "resource.h" |
---|
7 | #include "initguid.h" |
---|
8 | #include "MainDialog.h" |
---|
9 | |
---|
10 | //////////////////////////////////////////////////////////// |
---|
11 | // CEnumerateAudioDevicesModule |
---|
12 | |
---|
13 | class CEnumerateAudioDevicesModule : |
---|
14 | public CAtlExeModuleT<CEnumerateAudioDevicesModule>, |
---|
15 | public CWtlExeModuleT<CEnumerateAudioDevicesModule> |
---|
16 | { |
---|
17 | public: |
---|
18 | // CEnumerateAudioDevicesModule |
---|
19 | |
---|
20 | // CAtlExeModuleT |
---|
21 | CEnumerateAudioDevicesModule() throw() |
---|
22 | { |
---|
23 | AtlTraceSetDefaultSettings(); |
---|
24 | _W(CExceptionFilter::Initialize()); |
---|
25 | _Z4_THIS(); |
---|
26 | } |
---|
27 | ~CEnumerateAudioDevicesModule() throw() |
---|
28 | { |
---|
29 | _Z4_THIS(); |
---|
30 | CExceptionFilter::Terminate(); |
---|
31 | } |
---|
32 | HRESULT RegisterServer(BOOL bRegisterTypeLibrary = FALSE, const CLSID* pClassIdentifier = NULL) throw() |
---|
33 | { |
---|
34 | bRegisterTypeLibrary; |
---|
35 | return __super::RegisterServer(FALSE, pClassIdentifier); |
---|
36 | } |
---|
37 | HRESULT UnregisterServer(BOOL bUnregisterTypeLibrary, const CLSID* pClassIdentifier = NULL) throw() |
---|
38 | { |
---|
39 | bUnregisterTypeLibrary; |
---|
40 | return __super::UnregisterServer(FALSE, pClassIdentifier); |
---|
41 | } |
---|
42 | HRESULT PreMessageLoop(INT nShowCommand) throw() |
---|
43 | { |
---|
44 | _ATLTRY |
---|
45 | { |
---|
46 | __E(AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_COOL_CLASSES)); |
---|
47 | //__C(CWtlExeModule::Initialize()); |
---|
48 | __C(__super::PreMessageLoop(nShowCommand)); |
---|
49 | } |
---|
50 | _ATLCATCH(Exception) |
---|
51 | { |
---|
52 | _C(Exception); |
---|
53 | } |
---|
54 | return S_OK; |
---|
55 | } |
---|
56 | VOID RunMessageLoop() throw() |
---|
57 | { |
---|
58 | Lock(); |
---|
59 | { |
---|
60 | CMainDialog MainDialog; |
---|
61 | MainDialog.DoModal(); |
---|
62 | } |
---|
63 | if(GetLockCount() == 1) |
---|
64 | { |
---|
65 | m_dwTimeOut = 0L; |
---|
66 | m_dwPause = 0L; |
---|
67 | } |
---|
68 | Unlock(); |
---|
69 | } |
---|
70 | HRESULT PostMessageLoop() throw() |
---|
71 | { |
---|
72 | _ATLTRY |
---|
73 | { |
---|
74 | _V(__super::PostMessageLoop()); |
---|
75 | //CWtlExeModule::Terminate(); |
---|
76 | } |
---|
77 | _ATLCATCH(Exception) |
---|
78 | { |
---|
79 | _C(Exception); |
---|
80 | } |
---|
81 | return S_OK; |
---|
82 | } |
---|
83 | }; |
---|
84 | |
---|
85 | //////////////////////////////////////////////////////////// |
---|
86 | // Main |
---|
87 | |
---|
88 | CEnumerateAudioDevicesModule g_Module; |
---|
89 | |
---|
90 | int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR pszCommandLine, int nShowCommand) |
---|
91 | { |
---|
92 | return g_Module.WinMain(nShowCommand); |
---|
93 | } |
---|