1 | //////////////////////////////////////////////////////////// |
---|
2 | // Copyright (C) Roman Ryltsov, 2008-2011 |
---|
3 | // Created by Roman Ryltsov roman@alax.info |
---|
4 | // |
---|
5 | // $Id: EnumerateAudioDevices.cpp 11 2011-08-30 08:27:39Z roman $ |
---|
6 | |
---|
7 | #include "stdafx.h" |
---|
8 | #include "resource.h" |
---|
9 | #include "initguid.h" |
---|
10 | #include "MainDialog.h" |
---|
11 | |
---|
12 | //////////////////////////////////////////////////////////// |
---|
13 | // CEnumerateAudioDevicesModule |
---|
14 | |
---|
15 | class CEnumerateAudioDevicesModule : |
---|
16 | public CAtlExeModuleT<CEnumerateAudioDevicesModule>, |
---|
17 | public CWtlExeModuleT<CEnumerateAudioDevicesModule> |
---|
18 | { |
---|
19 | public: |
---|
20 | // CEnumerateAudioDevicesModule |
---|
21 | |
---|
22 | // CAtlExeModuleT |
---|
23 | CEnumerateAudioDevicesModule() throw() |
---|
24 | { |
---|
25 | #if _DEVELOPMENT |
---|
26 | AtlTraceLoadSettings(NULL); |
---|
27 | #endif // _DEVELOPMENT |
---|
28 | _W(CExceptionFilter::Initialize()); |
---|
29 | _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
---|
30 | } |
---|
31 | ~CEnumerateAudioDevicesModule() throw() |
---|
32 | { |
---|
33 | _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); |
---|
34 | CExceptionFilter::Terminate(); |
---|
35 | } |
---|
36 | HRESULT RegisterServer(BOOL bRegisterTypeLibrary = FALSE, const CLSID* pClassIdentifier = NULL) throw() |
---|
37 | { |
---|
38 | bRegisterTypeLibrary; |
---|
39 | return __super::RegisterServer(FALSE, pClassIdentifier); |
---|
40 | } |
---|
41 | HRESULT UnregisterServer(BOOL bUnregisterTypeLibrary, const CLSID* pClassIdentifier = NULL) throw() |
---|
42 | { |
---|
43 | bUnregisterTypeLibrary; |
---|
44 | return __super::UnregisterServer(FALSE, pClassIdentifier); |
---|
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 | Lock(); |
---|
63 | { |
---|
64 | CMainDialog MainDialog; |
---|
65 | MainDialog.DoModal(); |
---|
66 | } |
---|
67 | if(GetLockCount() == 1) |
---|
68 | { |
---|
69 | m_dwTimeOut = 0L; |
---|
70 | m_dwPause = 0L; |
---|
71 | } |
---|
72 | Unlock(); |
---|
73 | } |
---|
74 | HRESULT PostMessageLoop() throw() |
---|
75 | { |
---|
76 | _ATLTRY |
---|
77 | { |
---|
78 | _V(__super::PostMessageLoop()); |
---|
79 | //CWtlExeModule::Terminate(); |
---|
80 | } |
---|
81 | _ATLCATCH(Exception) |
---|
82 | { |
---|
83 | _C(Exception); |
---|
84 | } |
---|
85 | return S_OK; |
---|
86 | } |
---|
87 | }; |
---|
88 | |
---|
89 | //////////////////////////////////////////////////////////// |
---|
90 | // Main |
---|
91 | |
---|
92 | CEnumerateAudioDevicesModule g_Module; |
---|
93 | |
---|
94 | int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR pszCommandLine, int nShowCommand) |
---|
95 | { |
---|
96 | return g_Module.WinMain(nShowCommand); |
---|
97 | } |
---|