www.pudn.com > agentnet.zip > NewsDlg.cpp


// NewsDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "AgentNetServer.h" 
#include "NewsDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CNewsDlg dialog 
 
 
CNewsDlg::CNewsDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CNewsDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CNewsDlg) 
	m_strXwbt = _T(""); 
	m_strXwnr = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CNewsDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CNewsDlg) 
	DDX_Control(pDX, IDC_COMBO_XWLX, m_ComboXwlx); 
	DDX_Text(pDX, IDC_EDIT_XWBT, m_strXwbt); 
	DDX_Text(pDX, IDC_EDIT_XWNR, m_strXwnr); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CNewsDlg, CDialog) 
	//{{AFX_MSG_MAP(CNewsDlg) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CNewsDlg message handlers 
 
void CNewsDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	UpdateData(TRUE); 
 
	int iSel; 
	iSel=m_ComboXwlx.GetCurSel(); 
	m_ComboXwlx.GetLBText(iSel,m_strXwlx); 
 
	if (m_strXwlx==""||m_strXwbt==""||m_strXwnr=="") 
	{ 
		AfxMessageBox("请输入标题,内容,类型!"); 
		return; 
	} 
	 
	CDialog::OnOK(); 
} 
 
BOOL CNewsDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	 
	while(!m_MySet->EndOfFile) 
	{ 
   		_variant_t vXwlb; 
		 
		while(!m_MySet->EndOfFile) 
		{ 
			vXwlb=m_MySet->GetCollect(L"新闻类型"); 
   			m_ComboXwlx.AddString(_bstr_t(vXwlb)); 
			m_MySet->MoveNext(); 
		} 
 
	} 
 
	if (m_bModify==FALSE) 
		m_ComboXwlx.SetCurSel(1); 
	else 
	{ 
		m_ComboXwlx.SelectString(0,m_strXwlx);	 
	} 
	 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
}