vc6设置控件的值
时间:2011-02-08 来源:吴X
// DlgTest2.cpp : implementation file // #include "stdafx.h" #include "Text.h" #include "DlgTest2.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDlgTest2 dialog CDlgTest2::CDlgTest2(CWnd* pParent /*=NULL*/) : CDialog(CDlgTest2::IDD, pParent) { //{{AFX_DATA_INIT(CDlgTest2) m_strEdit1 = _T(""); //}}AFX_DATA_INIT } void CDlgTest2::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgTest2) DDX_Text(pDX, IDC_EDIT1, m_strEdit1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDlgTest2, CDialog) //{{AFX_MSG_MAP(CDlgTest2) ON_BN_CLICKED(IDC_NUMBER_DLG2_LABEL1, OnLABEL1_CLICK) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnBtn2_Click) ON_BN_CLICKED(IDC_LABEL2, On_Label2_CLICK) ON_BN_CLICKED(IDC_BUTTON3, On_Btn3_GetEdit1Value) ON_BN_CLICKED(IDC_BUTTON4, On_BTN4_SetEdit1Value) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDlgTest2 message handlers void CDlgTest2::OnLABEL1_CLICK() { MessageBox("hello谢谢点击"); } void CDlgTest2::OnButton1() { // TODO: Add your control notification handler code here MessageBox("hello谢谢点击Button"); } void CDlgTest2::OnBtn2_Click() { CString str; ((CEdit*)this->GetDlgItem(IDC_EDIT1))->GetWindowText(str); MessageBox(str); } void CDlgTest2::On_Label2_CLICK() { MessageBox("LABEL2 clicked"); } void CDlgTest2::On_Btn3_GetEdit1Value() { UpdateData(); MessageBox(this->m_strEdit1); } void CDlgTest2::On_BTN4_SetEdit1Value() { this->m_strEdit1="吴xx"; UpdateData(FALSE); }
http://hi.baidu.com/hushaobo_km/blog/item/d4f0b12d114e673f359bf77e.html
相关阅读 更多 +