www.pudn.com > SnmpToplog.rar > ActiveHostDlg.cpp


// ActiveHostDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "MySnmp.h" 
#include "ActiveHostDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CActiveHostDlg dialog 
 
 
CActiveHostDlg::CActiveHostDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CActiveHostDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CActiveHostDlg) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CActiveHostDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CActiveHostDlg) 
	DDX_Control(pDX, IDC_LIST1, m_ctrlList); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CActiveHostDlg, CDialog) 
	//{{AFX_MSG_MAP(CActiveHostDlg) 
	ON_WM_CLOSE() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CActiveHostDlg message handlers 
 
BOOL CActiveHostDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	if(m_pActiveHosts!=NULL) 
	{ 
		m_ctrlList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES); 
		m_ctrlList.InsertColumn(0,"主机IP地址",LVCFMT_LEFT,150); 
		m_ctrlList.InsertColumn(1,"状态",LVCFMT_LEFT,150); 
		for(int i=0;iGetSize();i++) 
		{ 
			char buf[10]; 
			sprintf(buf,"%d",i); 
			int nItem=m_ctrlList.InsertItem(i,buf); 
			m_ctrlList.SetItemText(nItem,0,m_pActiveHosts->GetAt(i)); 
			m_ctrlList.SetItemText(nItem,1,"活动的"); 
		} 
	} 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CActiveHostDlg::OnClose()  
{ 
	// TODO: Add your message handler code here and/or call default 
//	if() 
	CDialog::OnClose(); 
}