1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// ProgressDlg.h : Declaration of the CActionProgressDlg
#ifndef __ProgressDLG_H_
#define __ProgressDLG_H_
#include "resource.h" // main symbols
#include <atlwin.h>
#include <atlctrls.h>
#include "NSMessages.h"
#include "../common/events.h"
#include "../common/interfaces.h"
#include "NightSecError.h"
/////////////////////////////////////////////////////////////////////////////
// CActionProgressDlg
// This is the update window the Action Engine
// Handles receiving of the error and update messages
// Also catches events from host program
class CActionProgressDlg :
public CDialogImplEx,
public IDispEventImpl<0, CActionProgressDlg, &DIID_DShutdownEvents, &LIBID_NightSecShutdown, 2, 5>
{
public:
// Construction
CActionProgressDlg(IUnknown* pSite, UINT nIDD);
~CActionProgressDlg();
// Catch Cancel Events
BEGIN_SINK_MAP(CActionProgressDlg)
SINK_ENTRY_EX(0, DIID_DShutdownEvents, 1, OnCancelEv)
END_SINK_MAP()
// Message Map
BEGIN_MSG_MAP(CActionProgressDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(NSM_UPDATE, OnUpdateFile)
MESSAGE_HANDLER(NSM_ERROR, OnError)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
END_MSG_MAP()
// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// Message from Action Engine
LRESULT OnUpdateFile(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// Called in response to the button being pressed, window being closed, or
// event being fired
LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// Called when event Fired
STDMETHOD(OnCancelEv)();
// Message from CActionEngine
LRESULT OnError(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
bool PlayAmination(UINT nID);
protected:
bool m_bCancel; // True when cancelled, but not stopped
CProgressBarCtrl m_ctlProgress; // Progress Bar
IUnknownPtr m_pUnk; // Pointer from IObjectWithSite
INightSecErrorLogPtr m_pErrorLog; // ErrorLog on same object as m_pUnk
};
#endif //__ProgressDLG_H_
|