source: trunk/Utilities/ShowHresult/Application.cpp @ 937

Last change on this file since 937 was 313, checked in by roman, 10 years ago
File size: 1.8 KB
RevLine 
[313]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 "Module_i.h"
8#include "NotifyIconWindow.h"
9
10////////////////////////////////////////////////////////////
11// CShowHresultModule
12
13class CShowHresultModule : 
14        public CAtlExeModuleT<CShowHresultModule>,
15        public CWtlExeModuleT<CShowHresultModule>
16{
17public:
18
19//DECLARE_LIBID(LIBID_AlaxInfoShowHresult)
20
21//DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MODULE, "{...}")
22
23public:
24// CShowHresultModule
25        CShowHresultModule()
26        {
27                AtlTraceSetDefaultSettings();
28                _W(CExceptionFilter::Initialize());
29                _Z4_THIS();
30        }
31        ~CShowHresultModule()
32        {
33                _Z4_THIS();
34                CExceptionFilter::Terminate();
35        }
36        HRESULT PreMessageLoop(INT nShowCommand)
37        {
38                _ATLTRY
39                {
40                        TraceModuleVersion();
41                        __E(AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_COOL_CLASSES));
42                        //__C(CWtlExeModule::Initialize());
43                        __C(__super::PreMessageLoop(nShowCommand));
44                }
45                _ATLCATCH(Exception)
46                {
47                        _C(Exception);
48                }
49                return S_OK;
50        }
51        VOID RunMessageLoop()
52        {
53                Lock();
54                {
55                        CNotifyIconWindow Window;
56                        __E(Window.Create());
57                        __super::RunMessageLoop();
58                        if(Window.IsWindow())
59                                _W(Window.DestroyWindow());
60                }
61                if(GetLockCount() == 1)
62                {
63                        m_dwTimeOut = 0L;
64                        m_dwPause = 0L;
65                }
66                Unlock();
67        }
68        HRESULT PostMessageLoop()
69        {
70                _ATLTRY
71                {
72                        _V(__super::PostMessageLoop());
73                        //CWtlExeModule::Terminate();
74                }
75                _ATLCATCH(Exception)
76                {
77                        _C(Exception);
78                }
79                return S_OK;
80        }
81};
82
83CShowHresultModule _AtlModule;
84
85////////////////////////////////////////////////////////////
86// Main
87
88extern "C" int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, INT nShowCommand)
89{
90    return _AtlModule.WinMain(nShowCommand);
91}
92
Note: See TracBrowser for help on using the repository browser.