forked from bigmacd/trapreceiver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMibUnloadStatus.cpp
More file actions
120 lines (99 loc) · 2.71 KB
/
MibUnloadStatus.cpp
File metadata and controls
120 lines (99 loc) · 2.71 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include "stdafx.h"
#include "traprcvr.h"
#include "MibUnloadStatus.h"
#include "MibDb.h"
extern MibDb gDb;
MibUnloadStatus::MibUnloadStatus(CWnd* pParent /*=NULL*/)
:CDialog(MibUnloadStatus::IDD, pParent)
{
}
MibUnloadStatus::MibUnloadStatus(CString mib, CListBox* otherList)
//MibUnloadStatus::MibUnloadStatus(CString mib)
:CDialog(MibUnloadStatus::IDD, NULL),
mMib(mib),
mStatus(FALSE),
mSizeInitialized(FALSE),
mOtherList(otherList)
{
}
void MibUnloadStatus::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MibUnloadStatus)
DDX_Control(pDX, IDC_LIST2, mList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(MibUnloadStatus, CDialog)
//{{AFX_MSG_MAP(MibUnloadStatus)
ON_WM_SIZE()
ON_WM_GETMINMAXINFO()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL
MibUnloadStatus::OnInitDialog()
{
// get the minimum window size
CRect recT;
GetWindowRect(recT);
mMinSize = CPoint(recT.Width(), recT.Height());
mSizeInitialized = TRUE;
mDlgResizeHelper.Init(m_hWnd);
mDlgResizeHelper.Fix(mList,
DlgResizeHelper::kLeft,
DlgResizeHelper::kNoVFix);
mDlgResizeHelper.Fix(IDOK,
DlgResizeHelper::kWidthLeft,DlgResizeHelper::kHeightBottom);
// DlgResizeHelper::kNoHFix,
// DlgResizeHelper::kNoVFix);
CDialog::OnInitDialog();
std::string mib = mMib.GetBuffer(0);
gDb.DeleteMib(mib);
mStatus = TRUE;
mList.AddString("Mib successfully unloaded.");
#if 0
unsigned int tRecNum = 0;
unsigned int oRecNum = 0;
unsigned int eRecNum = 0;
CString where;
where.Empty();
try
{
where = "Error processing Trap Definitions";
tRecNum = gTrapMap->DeleteRecords(mMib.GetBuffer(0));
where = "Error processing Object Definitions";
oRecNum = gOidMap->DeleteRecords(mMib.GetBuffer(0));
where = "Error processing Enumeration Definitions";
eRecNum = gEnumMap->DeleteRecords(mMib.GetBuffer(0));
mStatus = TRUE;
CString msg;
msg.Format("%d Trap definitions were removed.", tRecNum);
mList.AddString(msg.GetBuffer(0));
msg.ReleaseBuffer();
msg.Empty();
msg.Format("%d Object Definitions were removed.", oRecNum);
mList.AddString(msg.GetBuffer(0));
msg.ReleaseBuffer();
msg.Empty();
msg.Format("%d Enumeration Defintions were removed.", eRecNum);
mList.AddString(msg.GetBuffer(0));
msg.ReleaseBuffer();
}
catch(...)
{
mList.AddString(where.GetBuffer(0));
}
#endif
return TRUE;
}
void
MibUnloadStatus::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
mDlgResizeHelper.OnSize();
}
void
MibUnloadStatus::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI )
{
if (mSizeInitialized)
lpMMI->ptMinTrackSize = mMinSize;
}