Agent.cpp
资源名称:SNMP范例源代码.zip [点击查看]
上传用户:shgx688
上传日期:2009-12-27
资源大小:855k
文件大小:2k
源码类别:
SNMP编程
开发平台:
MultiPlatform
- // Agent.cpp : implementation file
- //
- #include "stdafx.h"
- #include "oam.h"
- #include "Agent.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CAgent dialog
- CAgent::CAgent(CWnd* pParent /*=NULL*/)
- : CDialog(CAgent::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CAgent)
- m_community = _T("");
- //}}AFX_DATA_INIT
- }
- void CAgent::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAgent)
- DDX_Control(pDX, IDC_IPADDRESS_AGENT, m_IP);
- DDX_Text(pDX, IDC_EDIT_COMMUNITY, m_community);
- DDX_Control(pDX, IDOK, m_btOk);
- DDX_Control(pDX, IDCANCEL, m_btCancel);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CAgent, CDialog)
- //{{AFX_MSG_MAP(CAgent)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CAgent message handlers
- BOOL CAgent::OnInitDialog()
- {
- CDialog::OnInitDialog();
- m_IP.SetFocus();
- m_btOk.LoadAVI(IDR_AVI_OK);
- m_btCancel.LoadAVI(IDR_AVI_CANCEL);
- m_community="public";
- // m_agent=(CMainFrame*)m_pMainWnd->m_agent;
- BYTE fld0,fld1,fld2,fld3;
- _stscanf(m_agent,"%d.%d.%d.%d",&fld0,&fld1,&fld2,&fld3);
- m_IP.SetAddress( fld0,fld1,fld2,fld3);
- UpdateData(false);
- // TODO: Add extra initialization here
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CAgent::OnOK()
- {
- BYTE field0,field1,field2,field3;
- UpdateData();
- m_IP.GetAddress(field0,field1,field2,field3);
- m_agent.Format("%d.%d.%d.%d",field0,field1,field2,field3);
- CDialog::OnOK();
- }