📄 managemib.cpp
字号:
// ManageMib.cpp : implementation file
//
#include "stdafx.h"
#include "..\nms.h"
#include "ManageMib.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CManageMib dialog
CManageMib::CManageMib(CWnd* pParent /*=NULL*/)
: CDialog(CManageMib::IDD, pParent)
{
//{{AFX_DATA_INIT(CManageMib)
m_Caption = _T("");
m_OID = _T("");
//}}AFX_DATA_INIT
m_pos = 0;
}
void CManageMib::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CManageMib)
DDX_Text(pDX, IDC_MIB_CAPTION, m_Caption);
DDX_Text(pDX, IDC_MIB_EDIT_OID, m_OID);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CManageMib, CDialog)
//{{AFX_MSG_MAP(CManageMib)
ON_BN_CLICKED(IDC_MIB_ADD, OnMibAdd)
ON_BN_CLICKED(IDC_MIB_LAST, OnMibLast)
ON_BN_CLICKED(IDC_MIB_NEXT, OnMibNext)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// 添加MIB变量
void CManageMib::OnMibAdd()
{
if( UpdateData() == FALSE)
{
return ;
}
CComboBox *pComBox = NULL;
int iSelect =0;
pComBox = (CComboBox *)GetDlgItem(IDC_MIB_VALUE_TYPE);
if(pComBox)
{
iSelect = pComBox->GetCurSel();
}
if( AddMib((LPCTSTR)m_Caption , (LPCTSTR)m_OID , iSelect)
!= NULL)
{
AfxMessageBox("Mib 添加成功");
}
else
{
AfxMessageBox("Mib 添加失败");
}
}
/*-----------------------------------------------------------------*/
// 前一个
void CManageMib::OnMibLast()
{
CMib *pMib = GetMib(m_pos-1);
if(NULL != pMib)
{
m_pos--;
}
UpdateMibDlg(pMib);
}
/*-----------------------------------------------------------------*/
// 后一个
void CManageMib::OnMibNext()
{
CMib *pMib = GetMib(m_pos+1);
if(NULL != pMib)
{
m_pos++;
}
UpdateMibDlg(pMib);
}
/*-----------------------------------------------------------------*/
void CManageMib::UpdateMibDlg(CMib *pMib)
{
if(pMib)
{
CComboBox *pComBox = NULL;
int iSelect =0;
pComBox = (CComboBox *)GetDlgItem(IDC_MIB_VALUE_TYPE);
m_Caption.Format("%s" , pMib->MibCaption);
m_OID.Format("%s", pMib->MibOID);
if(pComBox)
{
pComBox->SetCurSel(pMib->MibValueType);
}
}
UpdateData(FALSE);
}
/*-----------------------------------------------------------------*/
BOOL CManageMib::OnInitDialog()
{
CDialog::OnInitDialog();
CMib *pMib = GetMib(m_pos);
UpdateMibDlg(pMib);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -