forked from bigmacd/trapreceiver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMibLoadStatus.cpp
More file actions
118 lines (96 loc) · 2.83 KB
/
MibLoadStatus.cpp
File metadata and controls
118 lines (96 loc) · 2.83 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
#include "stdafx.h"
#include "traprcvr.h"
#include "MibLoadStatus.h"
#include "MibParser.h"
#include "MibDb.h"
extern MibDb gDb;
MibLoadStatus::MibLoadStatus(CWnd* pParent)
:CDialog(MibLoadStatus::IDD, pParent),
mStatus(FALSE),
mOtherList(NULL),
mSizeInitialized(FALSE)
{
//{{AFX_DATA_INIT(MibLoadStatus)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
MibLoadStatus::MibLoadStatus(CString filename, CListBox* otherList)
//MibLoadStatus::MibLoadStatus(CString filename)
:CDialog(MibLoadStatus::IDD, NULL),
mStatus(FALSE),
mFileName(filename),
mOtherList(otherList),
mSizeInitialized(FALSE)
{
}
void
MibLoadStatus::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MibLoadStatus)
DDX_Control(pDX, IDC_LIST2, mList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(MibLoadStatus, CDialog)
//{{AFX_MSG_MAP(MibLoadStatus)
ON_WM_SIZE()
ON_WM_GETMINMAXINFO()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL
MibLoadStatus::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();
////////////////////////////////////////////////////////////////////
MibParser parser;
bool status = parser.Parse(&gDb, mFileName.GetBuffer(0));
// check if it is already loaded
if (false == status) // probably already - need better error reporting from parser.
{
CString msg = "The MIB ";
msg += parser.MibName();
msg += " is already loaded!";
mList.AddString(msg.GetBuffer(0));
// smiExit();
return TRUE;
}
// do some other reporting back to the user
////////////////////////////////////////////////////////////////////
CString msg;
msg.Empty();
// msg.Format("%d Object definitions were added.", numberOfObjectDefinitions);
msg.Format("%d variables were parsed.", parser.NumberOfVariables());
mList.AddString(msg.GetBuffer(0));
msg.ReleaseBuffer();
msg.Empty();
msg.Format("%d Object IDs were added.", parser.NumberOfObjectIds());
mList.AddString(msg.GetBuffer(0));
msg.ReleaseBuffer();
mOtherList->AddString(parser.MibName());
return TRUE;
}
void
MibLoadStatus::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
mDlgResizeHelper.OnSize();
}
void
MibLoadStatus::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI )
{
if (mSizeInitialized)
lpMMI->ptMinTrackSize = mMinSize;
}