www.pudn.com > SNMP·¶ÀýÔ´´úÂë.zip > ADRESSCOMBOBOX.CPP


// AdressComboBox.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "oam.h" 
#include "AdressComboBox.h" 
 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CAdressComboBox 
 
CAdressComboBox::CAdressComboBox() 
{ 
} 
 
CAdressComboBox::~CAdressComboBox() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CAdressComboBox, CComboBox) 
	//{{AFX_MSG_MAP(CAdressComboBox) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CAdressComboBox message handlers 
 
BOOL CAdressComboBox::AddNewAdress(LPCSTR str) 
{ 
	int nFound = FindStringExact(-1, str); 
	if (nFound == CB_ERR) 
	{ 
		InsertString(0, str); 
		SetCurSel(0); 
	} 
	else 
		SetCurSel(nFound); 
 
/*	int nFound = FindStringExact(-1, str); 
	if (nFound == CB_ERR) 
	{ 
		COMBOBOXEXITEM item; 
 
		item.mask = CBEIF_TEXT; 
		item.iItem = -1; 
		item.pszText = (LPTSTR)(LPCTSTR)str; 
		int index = InsertItem(&item); 
		if(index != -1) 
			SetCurSel(index); 
		else 
			return FALSE; 
	} 
	else 
		SetCurSel(nFound); 
*/	return TRUE; 
}